A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-March/043391.html below:

[Python-Dev] Rich comparisons

[Python-Dev] Rich comparisonsDelaney, Timothy C (Timothy) tdelaney at avaya.com
Sun Mar 21 17:18:21 EST 2004
> From: Edward Loper
> 
> If we *really* want nan==nan to be false, then it seems like 
> we have to 
> say that nan is unhashable.

Hmm - I suppose we could make a subclass of float specifically for NaN, and have that be a singleton. The float constructor could check for a NaN result, and return this singleton.

I'm worried that there might be a slowdown though.

> I'm also disturbed by the fact 
> that cmp() 
> has something different to say about their equality:
> 
>      >>> cmp(float('nan'), float('nan'))
>      0

Hmm - I guess it should technically throw an exception. However, I'd be happy if it returned -1. Would this affect the stability of sorting?

Tim Delaney

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4