On Sat, May 1, 2010 at 6:32 PM, Steven D'Aprano <st...@remove-this-cybersource.com.au> wrote: > On Sat, 01 May 2010 07:13:42 -0500, Tim Chase wrote: >> This doesn't preclude you from implementing a self-mutating += style >> __add__ method and returning "self", but it's usually a bad idea > > Obviously the Python dev team don't agree with that :) > > Just to prove that += for lists is not an accident: > >>>> a = set() >>>> b = a >>>> a |= set([1]) >>>> a > set([1]) >>>> b > set([1])
In both cases, __iOP__ operator methods are being used, not vanilla __OP__ methods, so neither of your examples are relevant to Mr. Chase's point. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list