Could somebody please explain the following behaviour?
X=2*[[]]
print X
X[0].append(1)
print X
yields
[[], []]
[[1], [1]]
I would expect the last list to be [[1], []]
. Indeed, the following
X=[[],[]]
print X
X[0].append(1)
print X
yields
[[], []]
[[1], []]
Why this difference?