3 ms·
Indeed at first glance it looks odd, but the alternative is that multiplying a sequence always does a deep copy. Actually what is "strange" is the behaviour in
by twixfel 3y ago
Indeed at first glance it looks odd, but the alternative is that multiplying a sequence always does a deep copy. Actually what is "strange" is the behaviour in combination with the syntax of a nested list. The behaviour itself is fine. Replace it with
class X:
pass
y = [X()] * 5
and suddenly I think the behaviour looks fairly reasonable.