On 2 Mar, 14:45, Alan Franzoni <[EMAIL PROTECTED]> wrote: > > I mean... I don't like that. I'm not really a Python expert, I found this > behaviour is documented in the language reference itself: > > http://docs.python.org/ref/augassign.html > > But... I don't know, still think it's confusing and not going to use it.
One way to think of it is this: a += b ...is more or less the same as... if hasattr(a, "__iadd__"): a = a.__iadd__(b) else: a = a + b Since __iadd__ might mutate an object, returning the same object, it's possible to say that the name "a" still points to the same object in such circumstances using the above scheme. Whether any rebinding or resetting of "a" actually takes place in such a situation (in CPython) might be considered an issue of optimisation, but I suppose augmented assignments with attributes might bring out some semantic differences, too, as can be seen by the note about class attributes at the end of the referenced section of the manual. Paul -- http://mail.python.org/mailman/listinfo/python-list