I am slowly trying to understand the difference between views and copys in numpy, as well as mutable vs. immutable types.
If I access part
When you do c = a[b], a.__get_item__ is called with b as its only argument, and whatever gets returned is assigned to c.
When you doa[b] = c, a.__setitem__ is called with b and c as arguments and whatever gets returned is silently discarded.
So despite having the same a[b] syntax, both expressions are doing different things. You could subclass ndarray, overload this two functions, and have them behave differently. As is by default in numpy, the former returns a copy (if b is an array) but the latter modifies a in place.