2011/12/25 Jordi Gutiérrez Hermoso
<jordigh@octave.org>
I have been instructed to bring this issue to the mailing list:
http://projects.scipy.org/numpy/ticket/1994
The issue is this corner case:
>>> idx = []
>>> x = np.array([])
>>> x[idx] #works
array([], dtype=float64)
>>> x[:, idx] #works
array([], dtype=float64)
>>> x = np.ones((5,0))
>>> x[idx] #works
array([], shape=(0, 0), dtype=float64)
>>> x[:, idx] #doesn't work
Traceback (most recent call last):
File "<ipython-input-27-7038691cb565>", line 1, in <module>
x[:, idx] #doesn't work
IndexError: invalid index
This is obviously inconsistent, but I think just fixing this one case is not enough; unexpected behavior with empty inputs/indexes keeps coming up. Do we need a clear set of rules that all functions follow and tests to ensure these rules are actually followed, or not?