[Numpy-discussion] Question about dtype

Valentin Haenel valentin at haenel.co
Wed Dec 10 15:26:01 EST 2014


Hi,

I am using numpy version 1.9.0 and Python 2.7.9 and have a question
about the dtype:

In [14]: np.dtype("<f8")
Out[14]: dtype('float64')

In [15]: np.dtype(u"<f8")
Out[15]: dtype('float64')

In [16]: np.dtype([("<f8", "<f8")])
Out[16]: dtype([('<f8', '<f8')])

So far so good. Now what happens if I use unicode?

In [17]: np.dtype([(u"<f8", "<f8")])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call
last)
<ipython-input-17-ce004acab7f5> in <module>()
----> 1 np.dtype([(u"<f8", "<f8")])

TypeError: data type not understood

Also, it really does need to be a tuple?

In [18]: np.dtype([["<f8", "<f8"]])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call
last)
<ipython-input-18-c82761d7306d> in <module>()
----> 1 np.dtype([["<f8", "<f8"]])

TypeError: data type not understood

Is this expected behaviour or should I file a bug-report/submit a
pull-request?

best,

V-



More information about the NumPy-Discussion mailing list