[Numpy-discussion] Views and Increments

Marten van Kerkwijk m.h.vankerkwijk at gmail.com
Mon Aug 8 12:32:36 EDT 2016


Hi Anakim,

The difference is really in the code path that gets taken: in the first
case, you go through `a.__getitem__(np.array([1,6,5])`, in the second
through `a.__setitem__(...)`. The increments would not work if you added an
extra indexing to it, as in:
```
a[np.array([1,6,5])][:] += 1
```

​(which would do `a.__getitem__(...).__setitem__(slice(None))`)

Hope this clarifies it,

Marten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160808/2c159f40/attachment.html>


More information about the NumPy-Discussion mailing list