Lluís Vilanova
2015-11-30 17:42:06 UTC
Hi,
TL;DR: There's a pending pull request deprecating some behaviour I find
unexpected. Does anyone object?
Some time ago I noticed that numpy yields unexpected results in some very
specific cases. An array can be used to index multiple elements of a single
[2, 3]]],
[[[0, 1],
[2, 3]]]])
Nonetheless, if a list is used instead, it is (unexpectedly) transformed into a
I've been informed that there's a pending pull request that deprecates this
behaviour [1], which could in the future be reverted to what is expected (at
least what I expect) from the documents (except for an obscure note in [2]).
The discussion leading to this mail can be found here [3].
[1] https://github.com/numpy/numpy/pull/4434
[2] http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#advanced-indexing
[3] https://github.com/numpy/numpy/issues/6564
Thanks,
Lluis
TL;DR: There's a pending pull request deprecating some behaviour I find
unexpected. Does anyone object?
Some time ago I noticed that numpy yields unexpected results in some very
specific cases. An array can be used to index multiple elements of a single
a = np.arange(8).reshape((2,2,2))
a[ np.array([[0], [0]]) ]
array([[[[0, 1],a[ np.array([[0], [0]]) ]
[2, 3]]],
[[[0, 1],
[2, 3]]]])
Nonetheless, if a list is used instead, it is (unexpectedly) transformed into a
a[ [[0], [0]] ]
array([[0, 1]])a[ [0], [0] ]
array([[0, 1]])a[( [0], [0] )]
array([[0, 1]])I've been informed that there's a pending pull request that deprecates this
behaviour [1], which could in the future be reverted to what is expected (at
least what I expect) from the documents (except for an obscure note in [2]).
The discussion leading to this mail can be found here [3].
[1] https://github.com/numpy/numpy/pull/4434
[2] http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#advanced-indexing
[3] https://github.com/numpy/numpy/issues/6564
Thanks,
Lluis
--
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth