When I was using array assignment using slicing, there is some thing strange happened. The source code is below:
import numpy as np
a = np.array([1,2,3,4]).reshape(2,2)
b = np.array([5,6,7,8]).reshape(2,2)
print(id(a))
print(id(b))
b = a[:]
b[1,1] = 10
print(b is a)
print(id(a))
print(id(b))
print(a)
print(b)
The result is given as:
From the result, the id of b and a is different after array assignment, but when I change the value of b, the value in a also changed. Why is this?
Using Sublime Text, Python 3.4.3.

numpyarrays.a[:]makes aviewnot a copy.duplicatesbecause this is about an array view v copy, not about list copies and deep copies. stackoverflow.com/questions/2612802/….numpyarrays are not lists