[SciPy-user] Confused about enhanced-scalar dtypes

LATORNELL, Doug Doug.LATORNELL at mdsinc.com
Mon Feb 27 11:53:23 CST 2006

Thanks, Travis.

I'm not sure how I got it into my head that the dtype argument took the
name of the type rather than the type object.  The latter is certainly
obvious to me now when I go back and read the Data-Type Descriptors
section in the NumPy book.

dtype=float it shall be!


> -----Original Message-----
> From: scipy-user-bounces at scipy.net 
> [mailto:scipy-user-bounces at scipy.net] On Behalf Of Travis Oliphant
> Sent: February 24, 2006 16:17
> To: SciPy Users List
> Subject: Re: [SciPy-user] Confused about enhanced-scalar dtypes
> LATORNELL, Doug wrote:
> >I built NumPy from SVN this morning and got a surprise 
> concerning dtype
> >arguments:
> >
> >In [24]: import numpy
> >
> >In [25]: numpy.__version__
> >Out[25]: ''
> >
> >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
> >  
> >
> I don't recommend using strings like "float".  Just use float 
> (which is a type-object).
> I don't think "float" is actually an accepted string.  There 
> are a few strings that are recognized and more could be 
> added, but I would just use dtype=float.
> >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.
> >  
> >
> dtype=float and dtype=numpy.float_  are similar.  Note the 
> absence of ""
> >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?
> >  
> >
> I'm surprised "float" worked before and then doesn't work 
> now.  But, there have been enough changes between 0.9.3 and 
> 0.9.5 that it's 
> possible.   But, don't do it that way :-)
> -Travis
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user

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