[Numpy-discussion] Indexing changes/deprecations
Sebastian Berg
sebastian at sipsolutions.net
Fri Sep 27 08:27:31 EDT 2013
Hey,
since I am working on the indexing. I was wondering about a few smaller
things:
* 0-d boolean array, `np.array(0)[True]` (will work now) would
give np.array([0]) as a copy, instead of the original array.
I guess I could add a FutureWarning or so, but I am not sure
and overall the chance of creating bugs seems low.
(The boolean index should always add 1 dimension and here,
remove 0 dimensions -> 1-d result.)
* All index operations return a view; never the object. This
means that `v = arr[...]` is slightly slower. But since it
does not affect `arr[...] = vals`, I think the speed
implications are negligible.
* Does anyone have an idea if there is a way to change the subclass
logic that view based item setting is implemented as:
np.asarray(subclass[index]) = vals
I somewhat think the subclass should rather implement `__setitem__`
instead of relying on numpy calling its `__getitem__`, but I
don't see how it can be changed.
* Still thinking a bit about implementing a keepdims keyword or
function, to handle matrix type logic mostly in the C-code.
And most importantly, is there any behaviour thing in the index
machinery that is bugging you, which I may have forgotten until now?
- Sebastian
More information about the NumPy-Discussion
mailing list