[Numpy-discussion] Questions about converting to numpy

Christopher Barker Chris.Barker at noaa.gov
Wed Apr 25 16:23:40 EDT 2007


Russell E. Owen wrote:
> So I finally bit the bullet and converted most of my code from Numeric 
> and numarray to numpy.

good for you!

I can only help with one:
> - Even after reading the book I'm not really clear on why one would use 
> numpy.float_ instead of numpy.float or float

They float and numpy.float are the same, and numpy.float_ is the same as 
numpy.float64:

 >>> import numpy
 >>> float is numpy.float
True
 >>> numpy.float64 is numpy.float64
True
 >>>

float was added to the numpy namespace so that we could write consistent 
code like:

a = array(object, numpy.float32)
b = array(object, numpy.float)

i.e. have it all in the same namespace.

I'm not sure why float_ is an alias for float64, though I'm guessing 
it's possible that on some platforms they are not the same.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the NumPy-Discussion mailing list