Problem with assigning variables of type List

Evgeny Pedya john at
Mon Aug 19 09:19:32 CEST 2002

Hello, Abhishek!
You wrote in conference comp.lang.python to <python-list at> on 18
Aug 2002 21:18:47 -0700:

 AR> Hello,
 AR>       It appears that,  a = b = []
 AR> is not the same as a=[]
 AR> b=[]
 AR> because in the previous case a and b will refer to the same list eg,
 >>>> b.append(23)
 >>>> a
 AR> [23]
 AR> I am completely baffled by this. Can someone please explain?
Yes, yes, yes!
>>>a, b = [], []

With best regards, Evgeny Pedya.

More information about the Python-list mailing list