"Boris Borcic" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

>being transformed to profit from simplifications I expected sets to allow.
>There, itemwise augmented assigments in loops very naturally transform to
>wholesale augmented assignments without loops. Except for this wart.

Your transformation amounted to switching from collection mutation to 
object rebinding.  In Python, that is a crucial difference.  That the 
mutation and rebinding were both done with augmented assignments is not 
terribly important except as this masks the difference.  When *you* read 
your code, you know that you will only call the inner function with a 
mutable collection object, so you know that the name will be rebound to the 
same object after mutation, so you can think of the augmented assignment as 
being the same as collection mutation.

But the compiler does not know any such thing about the target of the 
augmented assignment and must therefore treat the statement as an 
assigment.  It was a bug for a2 to do otherwise, even though the bug was 
locally optimal for this particular usage.

Terry Jan Reedy



_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to