A good example for this would be>>> a = [0]>>> l = [a] * 5>>> l[[0], [0], [0], [0], [0]]>>> l[0][0] = 1>>> l[[1], [1], [1], [1], [1]]
You can see how creating a list of lists using multiplication results in the same object being passed rather than being cloned. This means that anytime any one element is changed in the lists, all elements change. Having a set to 0 (a single integer, instead of a list with a single integer), would work fine: that is because python copies integers differently than lists. This can get confusing, so you should always avoid statements like [a] * 5.