[Numpy-discussion] NEP 21: Simplified and explicit advanced indexing

Eric Wieser wieser.eric+numpy at gmail.com
Tue Jun 26 03:11:57 EDT 2018


> I don't think it should be relegated to the "officially discouraged"
ghetto of `.legacy_index`

The way I read it, the new spelling lof that would be the explicit but not
discouraged `image.vindex[rr, cc]`.

> I would reserve warnings for the cases where the current behavior is
something no one really wants, like mixing slices and integer arrays.

These are the cases that would only be available under `legacy_index`.

Eric

On Mon, 25 Jun 2018 at 23:54 Robert Kern <robert.kern at gmail.com> wrote:

> On Mon, Jun 25, 2018 at 11:29 PM Andrew Nelson <andyfaff at gmail.com> wrote:
>
>> On Tue, 26 Jun 2018 at 16:24, Juan Nunez-Iglesias <jni.soma at gmail.com>
>> wrote:
>>
>>> > Plain indexing arr[...] should return an error for ambiguous cases.
>>> [...] This includes every use of vectorized indexing with multiple integer
>>> arrays.
>>>
>>> This line concerns me. In scikit-image, we often do:
>>>
>>> rr, cc = coords.T  # coords is an (n, 2) array of integer coordinates
>>> values = image[rr, cc]
>>>
>>> Are you saying that this use is deprecated? Because we love it at
>>> scikit-image. I would be very very very sad to lose this syntax.
>>>
>>
>>  I second Juan's sentiments wholeheartedly here.
>>
>
> And thirded. This should not be considered deprecated or discouraged. As I
> mentioned in the previous iteration of this discussion, this is the
> behavior I want more often than the orthogonal indexing. It's a really
> common way to work with images and other kinds of raster data, so I don't
> think it should be relegated to the "officially discouraged" ghetto of
> `.legacy_index`. It should not issue warnings or (eventual) errors. I would
> reserve warnings for the cases where the current behavior is something no
> one really wants, like mixing slices and integer arrays.
>
>
> --
> Robert Kern
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180626/ac6babba/attachment-0001.html>


More information about the NumPy-Discussion mailing list