[Numpy-tickets] [NumPy] #452: .tolist() for void scalar type is returning a tuple

NumPy numpy-tickets@scipy....
Wed Feb 14 06:44:20 CST 2007


#452: .tolist() for void scalar type is returning a tuple
--------------------+-------------------------------------------------------
 Reporter:  faltet  |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:          
Component:  Other   |     Version:          
 Severity:  normal  |    Keywords:          
--------------------+-------------------------------------------------------
 This exposes the problem:

 {{{
 In [37]: a=numpy.array((1,2,"asa"), "i2,i2,a3")

 In [38]: a.tolist()
 Out[38]: (1, 2, 'asa')

 In [39]: a.item()
 Out[39]: (1, 2, 'asa')

 In [40]: type(a.tolist())
 Out[40]: <type 'tuple'>

 In [41]: type(a.item())
 Out[41]: <type 'tuple'>

 }}}

 .tolist() for void scalar type is returning a tuple, and provided that
 .item() already returns a tuple, perhaps it would nice if .tolist() could
 return a list instead.

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


More information about the Numpy-tickets mailing list