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

Sebastian Berg sebastian at sipsolutions.net
Sun Apr 5 09:50:15 EDT 2015


On So, 2015-04-05 at 14:13 +0200, Sebastian Berg wrote:
> 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 
> <snip>
> > 
> > 
> > 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?

Also wondering, because while I think that actually changing numpy is
probably impossible, I do think we can talk about something like:

np.enable_outer_indexing()
or along the lines of:
from numpy.future import outer_indexing

or some such, to do a module wide switch and maybe also allow at some
point to make it easier to write code that is compatible between a
possible followup such as blaze (or also pandas I guess), that uses
incompatible indexing.
I have no clue if this is technically feasible, though.

The python equivalent would be teaching someone to use:

from __future__ import division

even though you don't even tell them that python 3 exists ;), just
because you like the behaviour more.


> 
<snip>
> > >>> a = np.arange(60).reshape(3, 4, 5)
> > >>> a.ix_
> <snip>
> > 
> > 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
> 
> _______________________________________________
> 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/eff14ef2/attachment.sig>


More information about the NumPy-Discussion mailing list