list.append problem?

newgene newgene at bigfoot.com
Mon Oct 1 17:45:59 EDT 2001


I am a newer of python. I have a problem like this code:

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

a,b,c become the same, although append method applied seperately.
It's really strange and unreasonable.
My python is ActivePython Build 210 running on WinNT.

Thank you

Chunlei



More information about the Python-list mailing list