[Numpy-discussion] NEP 21: Simplified and explicit advanced indexing (original) (raw)

Robert Kern robert.kern at gmail.com
Tue Jun 26 02:45:34 EDT 2018


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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180625/8493bd20/attachment.html>



More information about the NumPy-Discussion mailing list