[SciPy-User] Introducing outer/orthonongal indexing to numpy
sorry for cross posting (discussion should go to the numpy list). But I
would like to get a bit of discussion on the introduction of (mostly)
two new ways to index numpy arrays. This would also define a way for
code working with different array-likes, some of which implement outer
indexing (i.e. xray and dask I believe), to avoid ambiguity.
The new methods are (names up for discussion):
The difference beeing that `oindex` will return outer/orthogonal type
indexing, while `vindex` would be a (hopefully) less confusing variant
of "fancy" indexing.
The biggest reason for introducing this is to provide `oindex`
for situations such as:
>>> arr = np.arange(25).reshape((5, 5))
>>> arr[[0, 1], [1, 2]]
>>> # While most might expect the result to be:
>>> arr.oindex[[0, 1], [1, 2]]
To provide backwards compatibility the current plan is to also introduce
`arr.legacy_index[...]` or similar, with the (long term) plan to force
the users to explicitly choose `oindex`, `vindex`, or `legacy_index` if
the indexing operation is otherwise not well defined.
There are still some open questions for me regarding, for example:
* the exact time line (should we start deprecation immediately, etc.)
* the handling of boolean indexing arrays
* questions that might crop up about other array-likes/subclasses
* Are there indexing needs that we are forgetting but are related?
My current hope for going forward is to get clear feedback of what is
wanted, for the naming and generally from third party module people, so
that we can polish up the NEP and the community can accept it.
With good feedback, I think we may be able to get the new attributes
So if you are interested in teaching and have suggestions for the names,
or have thoughts about subclasses, or... please share your thoughts! :)