Whey aren't the two of these the same in python 3.7.1
?
1.
all = [[]] * 10
all[3].append(33)
> [[33], [33], [33], [33], [33], [33], [33], [33], [33], [33]]
2.
all = [[] for i in range(10)]
all[3].append(33)
> [[], [], [], [33], [], [], [], [], [], []]
Initially, I tried the first one while expecting the output from the second one but surprisingly this doesn't happen. Any clue why the same reference is initialized in the first snippet?