[NumPy-Tickets] [NumPy] #1870: Cannot assign a list-of-lists to dtype=object ndarray if sublists are equal-length

NumPy Trac numpy-tickets@scipy....
Thu Jun 16 15:00:49 CDT 2011


#1870: Cannot assign a list-of-lists to dtype=object ndarray if sublists are
equal-length
--------------------+-------------------------------------------------------
 Reporter:  mjuric  |       Owner:  somebody   
     Type:  defect  |      Status:  new        
 Priority:  high    |   Milestone:  Unscheduled
Component:  Other   |     Version:  1.6.0      
 Keywords:          |  
--------------------+-------------------------------------------------------
 This snippet illustrates the problem:

         x = np.zeros(4, dtype=object)
         y = [[1], [2], [3], [4]]
         x[:] = y

 In versions prior to 1.6, this code (as expected) assigned the sublists of
 y to x (so that, for example, x[2] would become [2]).

 In 1.6, this code raises an exception:

         ValueError: output operand requires a reduction, but reduction is
 not enabled

 However, if y is not a list of lists with equal number of elements:

         x = np.zeros(4, dtype=object)
         y = [[1], [2, 3], [3], [4]]
         x[:] = y

 no exception is raised.

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


More information about the NumPy-Tickets mailing list