float("nan") in set or as key

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon May 30 02:14:53 EDT 2011


On Mon, 30 May 2011 04:15:11 +0000, Steven D'Aprano wrote:

> On Mon, 30 May 2011 11:14:58 +1000, Chris Angelico wrote:
> 
>> So, apart from float("nan"), are there actually any places where real
>> production code has to handle NaN? I was unable to get a nan by any of
>> the above methods, except for operations involving inf; for instance,
>> float("inf")-float("inf") == nan. All the others raised an exception
>> rather than return nan.
> 
> That's Python's poor design, due to reliance on C floating point
> libraries that have half-hearted support for IEEE-754, and the
> obstruction of people who don't understand the usefulness of NANs.

That last comment mine is a bit harsh, and I'd like to withdraw it as 
unnecessarily confrontational.



-- 
Steven



More information about the Python-list mailing list