On Fri, Dec 12, 2008 at 4:56 AM, sturlamolden <sturlamol...@yahoo.no> wrote: > On Dec 12, 1:44 pm, "Chris Rebert" <c...@rebertia.com> wrote: > >> Python begs to differ, as those two statements are both semantically >> identical in this case: > > That is because integers are immutable. When x += 1 is done on an int, > there will be a rebinding. But try the same on say, a numpy array, and > the result will be different:
Yes, I know that. Did you not read the end of my email? Here it is again: """ If you were talking about lists rather than integers though, you'd be absolutely correct, as the += ends up being a method call to __iadd__ instead of a plain assignment. """ Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com -- http://mail.python.org/mailman/listinfo/python-list