[Numpy-tickets] [NumPy] #718: Bug with numpy.float32.tolist

NumPy numpy-tickets@scipy....
Sun Apr 6 11:22:47 CDT 2008


#718: Bug with numpy.float32.tolist
------------------------+---------------------------------------------------
 Reporter:  Elby        |        Owner:  somebody
     Type:  defect      |       Status:  new     
 Priority:  normal      |    Milestone:  1.1     
Component:  numpy.core  |      Version:  none    
 Severity:  normal      |   Resolution:          
 Keywords:              |  
------------------------+---------------------------------------------------
Changes (by oliphant):

  * milestone:  1.0.5 => 1.1

Comment:

 All of the numpy scalars have (almost) all of the same methods and
 attributes of numpy arrays.  That is intentional.   In addition, the
 behavior is generally equivalent to 0-d arrays in NumPy.

 Thus, the behavior of the numpy scalar tolist method is to do the
 equivalent of convert to 0-d array and then call tolist on the 0-d array.

 Currently, the 0-d array intentionally does not convert to a list (because
 0-d arrays are not iterable) but returns it's corresponding Python ojbect.
 There are two options here:

 1) Keep current behavior
 2) Raise an error
 3) Convert to a 1-element list

 All but option 1 must be put off until 1.1 because of the change in
 behavior.  My preference is to leave things as they are.  I like #3 the
 least because a 0-d array should not be thought of as a list.

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/718#comment:1>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list