Let's assume that a = []
and b = [1,2,3,4]
, if I use a.append(b)
, when some changes happend to b, a will change too. But if I use a.append(b[:])
, a will not change when b changes.
Actually I don't understand what happends behind this.
Let's assume that a = []
and b = [1,2,3,4]
, if I use a.append(b)
, when some changes happend to b, a will change too. But if I use a.append(b[:])
, a will not change when b changes.
Actually I don't understand what happends behind this.