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

NumPy Trac numpy-tickets@scipy....
Tue May 22 00:27:47 CDT 2012


#2139: Named dtype array: Difference between a[0]['name'] and a['name'][0]
--------------------+-------------------------------------------------------
 Reporter:  bmu     |       Owner:  somebody   
     Type:  defect  |      Status:  new        
 Priority:  normal  |   Milestone:  Unscheduled
Component:  Other   |     Version:  1.6.1      
 Keywords:          |  
--------------------+-------------------------------------------------------
 I came across a question on stackoverflow
 (http://stackoverflow.com/q/9470604) and I am wondering if this is 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
 }}}

 Travis wrote that this something like a "design" bug in a post at numpy-
 discussion:

 http://permalink.gmane.org/gmane.comp.python.numeric.general/50058

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


More information about the NumPy-Tickets mailing list