[Numpy-discussion] field access in recarray broken when field name matches class method or attribute

Christopher Hanley chanley at stsci.edu
Tue May 9 10:27:41 EDT 2006


It is not possible to access a named recarray field if that name matches 
the name of a recarray class method or attribute.  Example code is below:

 >>> from numpy import rec
 >>> r = 
rec.fromrecords([[456,'dbe',1.2],[2,'de',1.3]],names='num,name,field')
 >>> r.field('num')
array([456,   2])
 >>> r.field('field')
<bound method recarray.field of recarray([(456, 'dbe', 1.2), (2, 'de', 
1.3)],
       dtype=[('num', '<i4'), ('name', '|S3'), ('field', '<f8')])>
 >>>

I have opened a new ticket on the Trac site with this bug.

Chris




More information about the NumPy-Discussion mailing list