Augmented Assignement (was: Re: PEP scepticism)
Bernhard Herzog
bh at intevation.de
Fri Jun 29 05:24:14 EDT 2001
Carsten Geckeler <uioziaremwpl at spammotel.com> writes:
> As mentioned above, for tuples the "+=" is completely natural, but not for
> lists.
Funny, I mostly see it exactly the other way round. += modifies the left
hand side in place, so it's natural for a list, but not for a tuple.
I think the main problem (in as much as there actually is a problem) is
that whether augmented assignment rebinds the left hand side depends on
the type of object, i.e. whether the object implements the appropriate
methods, which is very different from normal assignment which always
rebinds.
Bernhard
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://mapit.de/
More information about the Python-list
mailing list