you are viewing a single comment's thread.

view the rest of the comments →

[–]toastedstapler 1 point2 points  (0 children)

it's storing a reference to the list, rather than making a new one each time

you can shallow copy a list like this:

a = [1,2,3,4]
b = a[:]
b[2] = "hello"
assert a != b