[Python-Dev] Scoping vs augmented assignment vs sets (Re: 'fast locals' in Python 2.5)
tjreedy at udel.edu
Wed Jun 14 16:50:05 CEST 2006
"Boris Borcic" <bborcic at gmail.com> wrote in message
news:e6on1i$bvc$1 at sea.gmane.org...
Terry Reedy wrote:
>> Your transformation amounted to switching from collection mutation to
>> object rebinding. In Python, that is a crucial difference.
>Ok, that is a crucial difference. The question becomes : is that
>the case of augmented assignment maintained for practical or for purity
>ideological reasons ?
Consistency. a op=b is almost the same as a = a op b except 1) 'a' is
computed only once and 2) if a is mutable, type(a) may choose to do op in
place via the call to __iop__ instead of __op__. But in any case, the
assigment is made and 'a', if a name, is bound to the result.
Anyway, this will not change for 2.x and further discussion is really
Terry Jan Reedy
More information about the Python-Dev