I have a question regarding the numpy subtraction assignment operator. When using the "-=" operator the referenced variable seems to be changed by the operation, which is not the case when the subtractor is substracted explicitly. Here is my MWE to illustrate this:
import numpy as np
np1 = np.array([1])
np2 = np1
np2 -= 2
print(np1)
np3 = np.array([1])
np4 = np3
np4 = np4 - 2
print(np3)
output:
[-1]
[1]
Why does the subtraction assignment operator behave in this way?