I was trying to do a shallow copy of numpy arrays using [:], like i normally would do with lists. However i found that this does not behave same as lists. I know that i can use .copy() method to solve this. But just wanted to understand whats happening under the hood with numpy here. can anyone please elaborate.
import numpy as np
a = np.array([1,2,3,4,5])
b = a[:]
print(id(b) == id(a)) # Ids are different, So different objects right ?
b[3] = 10
print(a, b) # Both a and b got updated