[NumPy-Tickets] [NumPy] #1730: asarray() with misshaped argument

NumPy Trac numpy-tickets@scipy....
Mon Jan 31 22:40:23 CST 2011

#1730: asarray() with misshaped argument
 Reporter:  friedrichromstedt  |       Owner:  somebody
     Type:  defect             |      Status:  new     
 Priority:  low                |   Milestone:  2.0.0   
Component:  numpy.core         |     Version:  1.5.0   
 Keywords:  asarray            |  
 consider following arguments to asarray(), with some bogus class X:

 1a)  [X(), numpy.asarray([1, 1])]

 1b)  [numpy.asarray([1, 1]), X()]

 2a)  [1, numpy.asarray([1, 1])]

 2b)  [numpy.asarray([1, 1]), 1]

 In cases (1ab), it seems to be obvious that the result shape should be
 (2,).  It is only in case (1a) (2,), in case 1b it's ().  Furthermore, the
 behaviour should not change dramatically when replacing objects by
 numbers, but cases (2ab) yield "ValueError: setting an array element with
 a sequence".

 The behaviour of (2ab) is understandable, but wouldn't it be positive to
 have consistent results across the dtype=numpy.object-ordinarydtype

 At least, it seems it should yield the same when reversing the argument

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

More information about the NumPy-Tickets mailing list