<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 8, 2016 at 6:11 AM, Anakim Border <span dir="ltr"><<a href="mailto:akborder@gmail.com" target="_blank">akborder@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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></div></blockquote><div><br></div><div>I haven't checked, but a likely explanation is that Python itself interprets a[b] += c as a[b] = a[b] + c.</div><div><br></div><div>Python has special methods for inplace assignment (__setitem__) and inplace arithmetic (__iadd__) but no special methods for inplace arithmetic and assignment at the same time, so this is really out of NumPy's control here.</div></div></div></div>