Creating numpy shallow copies with arithmetic operations
I noticed that array operations with an identity elements return a copy (possibly a shallow copy) of the array. Consider the code snippet below. a=np.arange(16).reshape([4,4]) print(a) b=a+0 print(b) a[2,2]=200 print(a) print(b) We see that b is a shallow copy of a. I don’t know if it is a deep copy, because I think matrix is… Read More Creating numpy shallow copies with arithmetic operations