[Numpy-discussion] annoying numpy string to float conversion behaviour

Torgil Svensson torgil.svensson at gmail.com
Tue Jun 26 14:27:14 EDT 2007

On 6/26/07, Andrew Straw <strawman at astraw.com> wrote:
> Torgil Svensson wrote:
> > This seems to indicate that float('nan') works on some platforms but
> > str(nan) isn't. Is this true on Linux? Could anyone confirm this? What
> > about float('inf') and repr(inf) on Linux?
> On Ubuntu Feisty (amd64) Linux (but this behavior has been the same for
> at least the 6 years I can remember.):
> $ python
> Python 2.5.1 (r251:54863, May  2 2007, 16:27:44)
> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> float('nan')
> nan
>  >>> float('inf')
> inf
>  >>> import numpy
>  >>> repr(numpy.inf)
> 'inf'
>  >>> repr(numpy.nan)
> 'nan'

I should have guessed this and tried it earlier, but the odds on
Windows in these cases are too low to give something in return. I
think I put this in the bag of annoyances/problems that will go away
with Windows and just live with it in the meantime.

Thanks for this report and all other good feedback from the list!


More information about the NumPy-Discussion mailing list