[NumPy-Tickets] [NumPy] #1994: Empty indices in empty arrays raise IndexError

NumPy Trac numpy-tickets@scipy....
Mon Dec 26 12:56:26 CST 2011


#1994: Empty indices in empty arrays raise IndexError
------------------------+---------------------------------------------------
 Reporter:  jordigh     |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  numpy.core  |     Version:  1.6.0      
 Keywords:              |  
------------------------+---------------------------------------------------
Changes (by rgommers):

  * component:  Other => numpy.core


Comment:

 Slightly more detailed example:
 {{{
 >>> 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
 }}}
 So issue only occurs for empty array of shape different from (0,) that is
 indexed with both a colon and an empty list.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1994#comment:4>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list