I've got this little piece of Python code:
x = [[]] * 3
x[1].append(1)
print(x)
Result:
[[1], [1], [1]]
...but what I expected it to to was something like this:
x = [[1], [2], [3]]
x[1].append(4)
print(x)
Result:
[[1], [2, 4], [3]]
What is the mechanism behind the first behavior? I certainly did not expect all the empty list spaces being filled by a simple append.