A = [1,2,3]
means you have a variable A
bound to an object [1,2,3]
:
A --------> [1,2,3]
When you write B = A
you get
A ----------v
[1,2,3]
B-----------^
So if we do e.g. A[1] = 2
we will have
A ----------v
[2,2,3]
B-----------^
and thus B[1] == 2
.
If you do B = copy(A)
you get
A --------> [1,2,3]
B --------> [1,2,3]
Now if you do A[1] = 2
you get
A --------> [2,2,3]
B --------> [1,2,3]
so in this case B[1] = 1
.