Problem with assigning variables of type List

Abhishek Roy abhishek at ocf.berkeley.edu
Mon Aug 19 06:18:47 CEST 2002


Hello,
      It appears that, 
a = b = []
is not the same as
a=[]
b=[]

because in the previous case a and b will refer to the same list eg,
>>> b.append(23)
>>> a
[23]
I am completely baffled by this. Can someone please explain?

Abhishek
(abhishek at ocf dot berkeley dot edu)



More information about the Python-list mailing list