<br><br><div class="gmail_quote">2011/12/25 Jordi Gutiérrez Hermoso <span dir="ltr"><<a href="mailto:jordigh@octave.org">jordigh@octave.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have been instructed to bring this issue to the mailing list:<br>
<br>
   <a href="http://projects.scipy.org/numpy/ticket/1994" target="_blank">http://projects.scipy.org/numpy/ticket/1994</a><br>
<br></blockquote><div>The issue is this corner case:<br> <br></div><div>>>> idx = []<br>>>> x = np.array([])<br>>>> x[idx]  #works<br>array([], dtype=float64)<br>>>> x[:, idx]  #works<br>
array([], dtype=float64)<br><br>>>> x = np.ones((5,0))<br>>>> x[idx]  #works<br>array([], shape=(0, 0), dtype=float64)<br>>>> x[:, idx]  #doesn't work<br>Traceback (most recent call last):<br>
  File "<ipython-input-27-7038691cb565>", line 1, in <module><br>    x[:, idx]  #doesn't work<br>IndexError: invalid index<br><br> </div></div>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?<br>
<br>Ralf<br>