According to this, python copies references when slicing. I've tried the following:
>>> a=[1,2,3]
>>> b=a[:]
>>> b[1]=0
>>> a
[1, 2, 3]
>>> b
[1, 0, 3]
>>> map(id,a)
[14508376, 14508352, 14508328]
>>> map(id,b)
[14508376, 14508400, 14508328]
Why does b[1]=0
does not change a[1]
(which should be the case if b[1]
was indeed a reference to the same object, one might think)? Instead, it seems to generate a new reference/id and change the new object. Anywhere I can read up on this behavior in more detail?