When I execute (I'm using the interactive shell) these statements I get this:
L=[1,2,3]
K=L
L.append(4)
L
[1,2,3,4]
K
[1,2,3,4]
But when I do exactly the same thing replacing L.append(4) with L=L+[4] I get:
L
[1,2,3,4]
K
[1,2,3]
Is this some sort of reference thing? Why does this happen?
Another funny thing I noticed is that L+=[4] acts like .append, which is odd as I thought it would act like L = L + [4].
Clarification to all of this would be greatly appreciated.
Thanks