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

Stephan Hoyer shoyer at gmail.com
Tue Jun 26 21:13:25 EDT 2018


On Tue, Jun 26, 2018 at 4:34 PM Robert Kern <robert.kern at gmail.com> wrote:

> I maintain that considering deprecation is premature at this time. Please
> take it out of this NEP. Let us get a feel for how people actually use
> .oindex/.vindex. Then we can talk about deprecation. This NEP gets my
> enthusiastic approval, except for the deprecation. I will be happy to talk
> about deprecation with an open mind in a few years. With some more actual
> experience under our belt, rather than prediction and theory, we can be
> more confident about the approach we want to take. Deprecation is not a
> fundamental part of this NEP and can be decided independently at a later
> time.
>

I agree, we should scale back most of the deprecations proposed in this
NEP, leaving them for possible future work. In particular, you're not
convinced yet that "outer indexing" is a more intuitive default indexing
mode than "vectorized indexing", so it is premature to deprecate vectorized
indexing behavior that conflicts with outer indexing. OK, fair enough.

I would still like to include at least two more limited form of deprecation
that I hope will be less controversial:
- Mixed boolean/integer array indexing. This is not very intuitive nor
useful, and I don't think I've ever seen it used. Usually "outer indexing"
behavior is what is desired here.
- Mixed array/slice indexing, for cases with arrays separated by slices so
NumPy can't do the "intuitive" transpose on the output. As noted in the
NEP, this is a common source of bugs. Users who want this should really
switch to vindex.

In the long term, although I agree with Sebastian that "outer indexing" is
more intuitive for default indexing behavior, I would really like to
eliminate the "dimension reordering" behavior of mixed array/slice indexing
altogether. This is a weird special case that is different between indexing
like array[...] from array.vindex[...]. So if we don't choose to deprecate
all cases where [] and oindex[] are different, I would at least like to
deprecate all cases where [] and vindex[] are different.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180626/0c725406/attachment.html>


More information about the NumPy-Discussion mailing list