float("nan") in set or as key
Robert Kern
robert.kern at gmail.com
Thu Jun 2 13:04:00 EDT 2011
On 6/2/11 8:05 AM, Grant Edwards wrote:
> Two of my perennial complaints about Python's handling of NaNs and
> Infs:
>
> 1) They weren't handle by pickle et al.
>
> 2) The string representations produced by repr() and accepted by
> float() weren't standardized across platforms.
>
> I think the latter has finally been fixed, hasn't it?
And the former!
Python 2.7.1 |EPD 7.0-2 (32-bit)| (r271:86832, Dec 3 2010, 15:41:32)
[GCC 4.0.1 (Apple Inc. build 5488)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> inf = 1e300*1e300
>>> nan = inf / inf
>>> import cPickle
>>> cPickle.loads(cPickle.dumps(nan))
nan
>>> cPickle.loads(cPickle.dumps(inf))
inf
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list