var or inout parm?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Dec 13 12:23:25 CET 2008


On Sat, 13 Dec 2008 02:20:59 +0100, Hrvoje Niksic wrote:

> Saner (in this respect) behavior in the tuple example would require a
> different protocol.  I don't understand why Python doesn't just call
> __iadd__ for side effect if it exists.  The decision to also rebind the
> result of __i*__ methods continues to baffle me.  I guess it is a result
> of a desire to enable the __i*__ methods to punt and return a different
> instance after all, but if so, that design decision brings more problems
> than benefits.

How often do you use ``+=`` with mutable objects?  I use it very often 
with number types and sometimes with tuples, and there rebinding is 
necessary.  If I couldn't use it in this way:  ``x = 0; x += z``, I'd 
call that a bad design decision.  It would be a quite useless operator 
then.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list