python assignment

dan danbmil99 at
Wed Jul 23 11:12:28 CEST 2003

"Tim Peters" < at> wrote in message news:<mailman.1058928524.20417.python-list at>...
>...  It would be very
> unusual (because bad design) for the __iadd__ method of a mutable type to
> return a pre-existing object, though.

>>> a = [1, 2]
>>> id(a)
>>> a += [3]
>>> id(a)

see my prev. post on this.  I realize my original assumptions were off
base, but frankly the documentation does a poor job (really no job) of
describing the state of affairs wrt how Python handles objects, and
how this affects what happens when you assign things.  A section on
names and binding principles would be much appreciated.


More information about the Python-list mailing list