Hi Python experts! Please explain this behavior:

>>> nn=3*[[]]
>>> nn
[[], [], []]
>>> mm=[[],[],[]]
>>> mm
[[], [], []]

Up till now, 'mm' and 'nn' look the same, right? Nope!

>>> mm[1].append(17)
>>> mm
[[], [17], []]
>>> nn[1].append(17)
>>> nn
[[17], [17], [17]]

???

Python 2.5 Win XP

Thanks!
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to