multivariable assignment

davidj411 davidj411 at gmail.com
Thu Dec 31 11:13:35 EST 2009


I am not sure why this behavior is this way.
at beginning of script, i want to create a bunch of empty lists and
use each one for its own purpose.
however, updating one list seems to update the others.

>>> a = b = c = []
>>> a.append('1')
>>> a.append('1')
>>> a.append('1')
>>> c
['1', '1', '1']
>>> a
['1', '1', '1']
>>> b
['1', '1', '1']



More information about the Python-list mailing list