[Numpy-discussion] NEP 21: Simplified and explicit advanced indexing
robert.kern at gmail.com
Tue Jun 26 21:38:44 EDT 2018
On Tue, Jun 26, 2018 at 6:14 PM Stephan Hoyer <shoyer at gmail.com> wrote:
> 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
> 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.
Actually, I do think outer indexing is more "intuitive"*, as far as that
goes. It's just rarely what I actually want to accomplish.
* I do not like using "intuitive" in programming. Nipples are intuitive.
Everything else is learned. But in this case, I think that outer indexing
is a more concordant extension of the concepts that a new numpy user would
have learned earlier: integer indices and slices.
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.
I'd still prefer not talking deprecation, per se, in this NEP (but my
objection is weaker). I would definitely start adding in informative, noisy
warnings in these cases, though. Along the lines of, "Hey, this is a dodgy
construction that typically gives unexpected results. Here are
.oindex/.vindex that might do what you actually want, but you can use
.legacy_index if you just want to silence this warning". Rather than "Hey,
this is going to go away at some point."
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion