In article <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >On Fri, 22 Feb 2008 11:00:17 -0800, Aahz wrote: >> >> It's just too convenient to be able to write >> >> L += ['foo'] >> >> without rebinding L. > ><nitpick>But ``+=`` does rebind.</nitpick> > >Doesn't matter in this case but we've had confused programmers asking >questions here when `L` is a class attribute and it's rebound to the >instance, or if they tried it on a list in a tuple. Extending a list >that's a read only property doesn't work either.
Fair point. And in fact the original primary use case for allowing the target of augmented assignment to return self was NumPy. Being able to use the simple syntax of augmented assignment instead of method calls in order to avoid copying huge arrays was a big win. (Which you probably know, but there are other people reading this thread who don't.) -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "All problems in computer science can be solved by another level of indirection." --Butler Lampson -- http://mail.python.org/mailman/listinfo/python-list