Hello,

What's the difference between "[[], [], []]" and  "3*[[]]" ?

>>> a,b,c = [[], [], []]
>>> id(a)
20609520
>>> id(b)
20722000
>>> id(c)
20721712

These ID is mutually different. But,

>>> a,b,c = 3*[[]]
>>> id(a)
20455728
>>> id(b)
20455728
>>> id(c)
20455728
>>>

These are the same. 

On the other hand,

>>> 3*[[]]
[[], [], []]

"[[], [], []]" is equal to  "3*[[]]" or not ?

After all, what should I do if I want to initialize a lot of lists ?
For example a = [], b = [], c = [],...., z = []

Thanks in advance,

Mitsuo
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to