python assignment

dan danbmil99 at yahoo.com
Wed Jul 23 05:12:28 EDT 2003


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

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

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.

dbm




More information about the Python-list mailing list