var or inout parm?

sturlamolden sturlamolden at yahoo.no
Sat Dec 13 15:26:59 EST 2008


On 13 Des, 02:20, Hrvoje Niksic <hnik... at xemacs.org> wrote:

> > tmp = mytuple.__getitem__(0)
> > tmp = tmp.__iadd__(1)
> > mytuple.__setitem__(0, tmp) # should this always raise an exception?
>
> What do you mean by "a sane parser"?  This is exactly what happens in
> current Python.  

Yes, but Steve Holden was suggesting mytuple.__iadd__ would be
invoked.

> The decision to also rebind
> the result of __i*__ methods continues to baffle me.  

Python methods always have a return value, even those that seem to do
not - they silently return None. Thus, __iadd__ must return self to
avoid rebinding to None.





More information about the Python-list mailing list