[Numpy-discussion] DEP: Deprecate boolean array indices with non-matching shape #4353

Benjamin Root ben.root at ou.edu
Thu Jun 4 21:22:36 EDT 2015


On Thu, Jun 4, 2015 at 9:04 PM, Nathaniel Smith <njs at pobox.com> wrote:

> On Thu, Jun 4, 2015 at 5:57 PM, Nathaniel Smith <njs at pobox.com> wrote:
>
> One place where the current behavior is particularly baffling and annoying
> is when you have multiple boolean masks in the same indexing operation. I
> think everyone would expect this to index separately on each axis ("outer
> product indexing" style, like slices do), and that's really the only useful
> interpretation, but that's not what it does...:
>
>
As a huge user of boolean indexes, I have never expected this to work in
any way, shape or form. I don't think it works in matlab (but someone
should probably check that), so you wouldn't have to worry about converts
missing a feature from there. I have always been told that boolean indexing
will produce a flattened array, and I wouldn't want to be dealing with
magic when the array does not match up right.

Now, what if the boolean array is broadcastable (dimension-wise, not
length-wise)? I do see some uses there. Modulo that, my vote is to
deprecate.

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150604/c3585888/attachment.html>


More information about the NumPy-Discussion mailing list