[Python-Dev] PyObject_RichCompareBool identity shortcut

Terry Reedy tjreedy at udel.edu
Wed Apr 27 21:48:03 CEST 2011


On 4/27/2011 2:41 PM, Glenn Linderman wrote:

> One issue that I don't fully understand: I know there is only one
> instance of None in Python, but I'm not sure where to discover whether
> there is only a single, or whether there can be multiple, instances of
> NaN or Inf.

I am sure there are multiple instances with just one bit pattern, the 
same as other floats. Otherwise, float('nan') would have to either 
randomly or systematically choose from among the possibilities. Ugh.

There are functions in the math module that pull apart (and put 
together) floats.

 > The IEEE 754 spec is clear that there are multiple bit
> sequences that can be used to represent these,

Anyone actually interested in those should use C or possibly the math 
module float assembly function.

 > so I would hope that
> there can be, in fact, more than one value containing NaN (and Inf).

If you do not know which pattern is which, what use could such passibly be?

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list