[Numpy-discussion] possible bug in dtype for records

Stefan van der Walt stefan at sun.ac.za
Wed Feb 15 10:38:05 EST 2006


In [3]: numpy.__version__
Out[3]: ''

I see the following:

In [4]: import numpy as N

In [5]: ctype = N.dtype({'names': ('x', 'y', 'z'), 'formats' : [N.float32, N.float32, N.float32]})

In [6]: ctype
Out[6]: dtype([('x', '<f4'), ('y', '<f4'), ('z', '<f4')])

In [7]: N.array([(1,2,3), (4,5,6)], dtype=ctype)
Segmentation fault

However, when I use a mutable list for defining dtype, i.e.

'names': ['x', 'y', 'z'] instead of
'names': ('x', 'y', 'z')

it works fine.

Is this expected behaviour?


More information about the NumPy-Discussion mailing list