[Numpy-discussion] Advanced indexing: "fancy" vs. orthogonal

Sebastian Berg sebastian at sipsolutions.net
Sun Apr 5 08:13:22 EDT 2015

On So, 2015-04-05 at 00:45 -0700, Jaime Fernández del Río wrote:
> On Fri, Apr 3, 2015 at 10:59 AM, Jaime Fernández del Río 
> A PR it is, #5749 to be precise. I think it has all the bells and
> whistles: integers, boolean and integer 1-D arrays, slices, ellipsis,
> and even newaxis, both for getting and setting. No tests yet, so
> correctness of the implementation is dubious at best. As a small
> example:

Looks neat, I am sure there will be some details. Just a quick thought,
I wonder if it might make sense to even introduce a context manager. Not
sure how easy it is to make sure that it is thread safe, etc?

If the code is not too difficult, maybe it can even be moved to C.
Though I have to think about it, I think currently we parse from first
index to last, maybe it would be plausible to parse from last to first
so that adding dimensions could be done easily inside the preparation
function. The second axis remapping is probably reasonably easy (if,
like the first thing, tedious).

- Sebastian

PS: One side comment about the discussion. I don't think anyone suggests
that we should not/do not even consider proposals as such, even if it
might looks like that. Not that I can compare, but my guess is that
numpy is actually very open (though no idea if it appears like that,

But also to me it does seem like a lost cause to try to actually change
indexing itself. So maybe that does not sound diplomatic, but without a
specific reasoning about how the change does not wreak havoc, talking
about switching indexing behaviour seems a waste time to me. Please try
to surprise me, but until then....

> >>> a = np.arange(60).reshape(3, 4, 5)
> >>> a.ix_
> Jaime
> -- 
> (\__/)
> ( O.o)
> ( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus
> planes de dominación mundial.
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150405/4d3d6ab6/attachment.sig>

More information about the NumPy-Discussion mailing list