Augmented Assignement (was: Re: PEP scepticism)
fredrik at pythonware.com
Tue Jul 3 09:17:53 CEST 2001
> Well, the Python world before augmented assignment was quite simple:
> Operators never changed the objects they acted on.
nothing prevents __add__ from changing the objects.
> Now we have augmented assignments. x=+y _can_ change the object
> bound to x, depending if x is mutable or immutable.
has nothing to do with mutability, and all to do with how the
__iadd__ method is implemented:
+ is an alias for __add__
+= is an alias for __iadd__
as for all other operators, the exact semantics are up to the
More information about the Python-list