[Python-Dev] Rich comparisons (original) (raw)
Delaney, Timothy C (Timothy) tdelaney at avaya.com
Sun Mar 21 17🔞21 EST 2004
- Previous message: [Python-Dev] Re: [Python-checkins] python/dist/src/Objectstupleobject.c, 2.86, 2.87
- Next message: [Python-Dev] An issue recently brought up in patch #872326 (generator expression)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] Re: [Python-checkins] python/dist/src/Objectstupleobject.c, 2.86, 2.87
- Next message: [Python-Dev] An issue recently brought up in patch #872326 (generator expression)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]