[NumPy-Tickets] [NumPy] #2068: Named dtype array: Difference between a[0]['name'] and a['name'][0]?

NumPy Trac numpy-tickets@scipy....
Mon Feb 27 10:19:44 CST 2012


#2068: Named dtype array: Difference between a[0]['name'] and a['name'][0]?
--------------------------+-------------------------------------------------
 Reporter:  nschloe       |       Owner:  somebody   
     Type:  defect        |      Status:  new        
 Priority:  normal        |   Milestone:  Unscheduled
Component:  Other         |     Version:  1.6.1      
 Keywords:  dtype, array  |  
--------------------------+-------------------------------------------------
 Hi!

 I came across the following oddity in numpy which may or may not be a bug:

 {{{
 import numpy as np
 dt = np.dtype([('tuple', (int, 2))])
 a = np.zeros(3, dt)
 type(a['tuple'][0])  % ndarray
 type(a[0]['tuple'])  % ndarray

 a['tuple'][0] = (1,2)  % ok
 a[0]['tuple'] = (1,2)  % ValueError: shape-mismatch on array construction
 }}}

 I would have expected that both of the options below work.
 Opinions?

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


More information about the NumPy-Tickets mailing list