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

Sebastian Berg sebastian at sipsolutions.net
Fri Jun 5 11:45:27 EDT 2015

On Fr, 2015-06-05 at 08:36 -0400, josef.pktd at gmail.com wrote:
> What is actually being deprecated?
> It looks like there are different examples.
> wrong length: Nathaniels first example above, where the mask is not
> broadcastable to original array because mask is longer or shorter than
> shape[axis].
> I also wouldn't have expected this to work, although I use np.nozero
> and boolean mask indexing interchangeably, I would assume we need the
> correct length for the mask.

For the moment we are only talking about wrong length (along a given
dimension). Not about wrong number of dimensions or multiple boolean
As a side note: I don't think the single boolean index behaviour needs
change, it is ok. Yes, it is not quite broadcasting, but there is no
help considering transparent multidimensional indexing.
As for multiple booleans, I think is more part of the "outer" indexing
discussion, which is interesting but not here :).

- Sebastian

> The second case where the boolean mask has an extra dimension of
> length one, or several boolean arrays might need more checking.
> I'm pretty sure I used various version, assuming they are a feature,
> and when I see arrays, I usually don't assume "outer product
> indexing"  (that might lead to a similar discussion as the recent
> fancy versus orthogonal indexing)
> Josef
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150605/50b80c6f/attachment.sig>

More information about the NumPy-Discussion mailing list