list slice is copy
examples/lists/list_slice_is_copy.py
x = [1, 1, 2, 3, 5, 8, 13, 21, 34] y = x[2:5] print(y) # [2, 3, 5] x[2] = 20 print(x) # [1, 1, 20, 3, 5, 8, 13, 21, 34] print(y) # [2, 3, 5]
x = [1, 1, 2, 3, 5, 8, 13, 21, 34] y = x[2:5] print(y) # [2, 3, 5] x[2] = 20 print(x) # [1, 1, 20, 3, 5, 8, 13, 21, 34] print(y) # [2, 3, 5]