[Numpy-discussion] Non-meta indexing improvements discussion
sebastian at sipsolutions.net
Thu Apr 9 03:07:59 EDT 2015
On Do, 2015-04-09 at 08:50 +0200, Sebastian Berg wrote:
> Hi all,
> Let me take a shot at summing up some suggestions to make the indexing
> less surprising, and maybe we can gather some more in a more
> concentrated way now.
Did not want to comment on the first mail
> 1. Implement something like `arr.fancy_index[...]` and
> `arr.ortho_index[...]` (i.e. Jaimes PR is the start for trying this)
I like this, personally. There is not much to be lost and I fully agree
with Robert on this. It opens up a lot of possibilities for us and
especially also others.
> 2. Add warnings for non-consecutive advanced indexing (i.e. the original
> example `arr[0, :, index_array]`).
This could be annoying sometimes, but then warnings do not break legacy
code, and I think in new code again Robert is right for these cases
using arr.fancy_index[...] is more explicit and a nice warning/google
help to the confused reader.
> 3. I do not know if it possible or useful, but I could imagine a module
> wide switch (similar to __future__ imports) to change the default
> indexing behaviour.
OK, my suggestion.... But actually I do not know if I like it all that
much (nor if it can be done) since 1. and 2. seem to me like enough. But
if someone feels strongly about fancy indexing being bad, I wanted to
point out that there may be ways to go down the road to "switch" numpy
without actually switching.
> One more thing, implementing this (especially the "new" indexing) is
> non-trivial, so as always help beyond just a discussion is appreciated
> and in my opinion the best way to push an actual change to happen sooner
> rather then in some far off future. I do not have time for concentrating
> much on an implementation for a while myself for a while at least.
> - Sebastian
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: This is a digitally signed message part
More information about the NumPy-Discussion