For example, if we have a numpy array
B = A
B[:] = A
All three versions do different things.
This binds a new name
B to the existing object already named
A. Afterwards they refer to the same object, so if you modify one in place, you'll see the change through the other one too.
This copies the values from
A into an existing array
B. The two arrays must have the same shape for this to work.
B[:] = A[:] does the same thing (but
B = A[:] would do something more like 1).
This is not legal syntax. You probably meant
B = numpy.copy(A). This is almost the same as 2, but it creates a new array, rather than reusing the
B array. If there were no other references to the previous
B value, the end result would be the same as 2, but it will use more memory temporarily during the copy.
Edit: or maybe you meant
numpy.copyto(B, A), which is legal, and is equivalent to 2?