I have a list and I want to understand slices of it. I take a slice [0:1]
of it:
>>> l=[1,2,3,4]
>>> id(l[0])
140079803522784
>>> id(l[0:1][0])
140079803522784
They are the same. But:
>>> l[0]=7
>>> l
[7, 2, 3, 4]
>>> l[0:1][0]=13
>>> l
[7, 2, 3, 4]
So the slice's 0-element is the same as the list's 0-element, but when I change it in the slice, it is not changed in the list. Why not?