Just figured why:

If I type this on the kernel:

weirdList = [[0]*3]*5

weirdList
Out[257]: [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]

weirdList[0][0] = 1

weirdList
Out[259]: [[1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0], [1, 0, 0]]

All first elements of the sublists also changes. I dunno why...
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to