[Python-Dev] Scoping vs augmented assignment vs sets (Re: 'fast locals' in Python 2.5) (original) (raw)

Terry Reedy 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 difference in the case of augmented assignment maintained for practical or for purity aka 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 c.l.p. material.

Terry Jan Reedy



More information about the Python-Dev mailing list