[NumPy-Tickets] [NumPy] #2199: PySequence_Check should return 0 for 0-d arrays

NumPy Trac numpy-tickets@scipy....
Thu Aug 9 05:16:51 CDT 2012


#2199: PySequence_Check should return 0 for 0-d arrays
------------------------+---------------------------------------------------
 Reporter:  batavus     |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  numpy.core  |     Version:  devel      
 Keywords:              |  
------------------------+---------------------------------------------------
 0-d arrays are not iterable:

 >>> list(numpy.array(1))
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 TypeError: iteration over a 0-d array

 Consequently, they do not provide the sequence protocol: PySequence_Length
 and PySequence_GetItem fail when called for a 0-d array.

 However, PySequence_Check returns 1.  It should return 0.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2199>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list