[Numpy-tickets] [NumPy] #390: repr() on recarray failure

NumPy numpy-tickets at scipy.net
Wed Nov 22 11:11:26 CST 2006

#390: repr() on recarray failure
 Reporter:  AndrewStraw  |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  normal       |   Milestone:          
Component:  Other        |     Version:          
 Severity:  normal       |    Keywords:          
 The script

 import numpy

 a= numpy.rec.array([ (1, 2, 3)],dtype=[('a', numpy.int8),
                                        ('b', numpy.int8),
                                        ('c', numpy.int8)])


 from numpy import *

 results in

 Traceback (most recent call last):
   File "NUMPY_RECARRAY_BUG.py", line 10, in ?
   File "<string>", line 2, in ?
   File "/usr/lib/python2.4/site-packages/numpy/core/records.py", line 181,
 in __new__
     self = ndarray.__new__(subtype, shape, (record, descr))
 TypeError: an integer is required

 Adding {{{x = x.replace('recarray','rec.array')}}} before eval() stops the
 exception. I think this illustrates that rec.array's {{{__repr__()}}}
 should print 'rec.array' rather than 'recarray'. However, I'm no recarray

Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/390>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list