I was just messing around with Python, and came across some weird behaviour with append. Python version is 3.11.5.
>>> o = [[]]*4
>>> o
[[], [], [], []]
>>> o[0].append(0)
>>> o
[[0], [0], [0], [0]]
Append seems to perform the operation on all elements of the array here, but it doesn’t seem to do the same if you set o = [[], [], [], []]
manually, or o = [0] * 4
and perform addition on it for example. I suspect it might have something to do with how append and list construction works in this case, but not sure why.