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

Nathaniel Smith njs at pobox.com
Thu Jun 4 20:57:35 EDT 2015


So specifically the question is -- if you have an array with five items,
and a Boolean array with three items, then currently you can use the later
to index the former:

arr = np.arange(5)
mask = np.asarray([True, False, True])
arr[mask] # returns array([0, 2])

This is justified by the rule that indexing with a Boolean array should be
the same as indexing with the same array that's been passed to
np.nonzero(). Empirically, though, this causes constant confusion and does
not seen very useful, so the question is whether we should deprecate it.

-n
On Jun 4, 2015 5:30 PM, "Charles R Harris" <charlesr.harris at gmail.com>
wrote:

>
>
> On Thu, Jun 4, 2015 at 6:26 PM, Charles R Harris <
> charlesr.harris at gmail.com> wrote:
>
>> Hi All,
>>
>> I've not strong feelings one way or the other on this proposed
>> deprecation for numpy 1.10 and would like some feedback from interested
>> users.
>>
>
> Umm, link is #4353 <https://github.com/numpy/numpy/pull/4353>.
>
> Chuck
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150604/d884b7a8/attachment.html>


More information about the NumPy-Discussion mailing list