[SciPy-user] Confused about enhanced-scalar dtypes

LATORNELL, Doug Doug.LATORNELL at mdsinc.com
Fri Feb 24 15:53:29 CST 2006


I built NumPy from SVN this morning and got a surprise concerning dtype
arguments:

In [24]: import numpy

In [25]: numpy.__version__
Out[25]: '0.9.6.2165'

In [26]: a = numpy.fromfile("profiles-O0", dtype="float", sep=' ')
------------------------------------------------------------------------
---
exceptions.TypeError                                 Traceback (most
recent call last)

/ocean/dlatorne/SoG/dlatornell06/profiles/<ipython console> 

TypeError: data type not understood

In [27]: a = numpy.fromfile("profiles-O0", dtype="float_", sep=' ')

In [28]: a[:5]
Out[28]: array([ 282.8318,   27.2176,   20.932 ,    5.9051,    0.    ])


But on a several week old build on an other machine:

In [1]: import numpy

In [2]: numpy.__version__
Out[2]: '0.9.3.1868'

In [3]: a = numpy.fromfile("test", dtype="float", sep=" ")

In [4]: a = numpy.fromfile("test", dtype="float_", sep=" ")
------------------------------------------------------------------------
---
exceptions.TypeError                                 Traceback (most
recent call last)

/home/doug/<console> 

TypeError: data type not understood

In [5]:


Based on the tip in the middle of pg 19 of my copy of the NumPy book, I
expected both dtype="float" and dtype="float_" to work.

I know there has been a bunch of work lately on things related to dtype,
but I don't recall seeing anything about breaking the equivalence of the
enhanced-scalar types (like float_) and the corresponding standard
Python types (float, in this case).  Did I miss, or misunderstand
something, get unluck with the timing of my checkout this morning, or is
this a bug?

Doug



This email and any files transmitted with it may contain privileged or confidential information and may be read or used only by the intended recipient.  If you are not the intended recipient of the email or any of its attachments, please be advised that you have received this email in error and any use, dissemination, distribution, forwarding, printing or copying of this email or any attached files is strictly prohibited.  If you have received this email in error, please immediately purge it and all attachments and notify the sender by reply email or contact the sender at the number listed.



More information about the SciPy-user mailing list