[Numpy-discussion] float32 is not a float ?
Charles R Harris
Thu Apr 10 14:32:35 CDT 2008
On Thu, Apr 10, 2008 at 12:38 PM, Charles Doutriaux <email@example.com>
> I guess this maybe "normal" but it breaks a lot of thing when conterting
> from Numeric
> >>> a=numpy.ones(5,dtype=numpy.float32)
> >>> isinstance(a,float)
It looks like float in this case is a python float, not a numpy float.
> float64 works...
It has the same underlying c type as the python float. Maybe it should fail?
> I can see why one could argue for returning False, but then the
> converter might be too zealous
> things that used to work like:
> if type(item) in [types.IntType, types.FloatType]:
> isinstance(item, types.FloatType)
> now fail,
> should we be concerned? should we consider returning True ?
I think you want the isreal function, but it will also return true for
complex with 0 imaginary part. Hmm... the various iswhatever functions seem
to be lacking in coverage. Maybe we should fix that.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion