<div dir="ltr">Dear List,<br><br>I'm experimenting with views and array indexing. I have written two code blocks that I was expecting to produce the same result.<br><br>First try:<br><br>>>> a = np.arange(10)<br>>>> b = a[np.array([1,6,5])]<br>>>> b += 1<br>>>> a<br>array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])<br><br><br>Alternative version:<br><br>>>> a = np.arange(10)<br>>>> a[np.array([1,6,5])] += 1<br>>>> a<br>array([0, 2, 2, 3, 4, 6, 7, 7, 8, 9])<br><br><br>I understand what is happening in the first case. In fact, the documentation is quite clear on the subject:<br><br>For all cases of index arrays, what is returned is a copy of the original data, not a view as one gets for slices.<br><br>What about the second case? There, I'm not keeping a reference to the intermediate copy (b, in the first example). Still, I don't see why the update (to the copy) is propagating to the original array. Is there any implementation detail that I'm missing?<br><br>Best,<br>  ab<br></div>