[Python-Dev] Why is nan != nan? (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 25 23:45:51 CET 2010
- Previous message: [Python-Dev] Why is nan != nan?
- Next message: [Python-Dev] Why is nan != nan?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Georg Brandl wrote:
Thinking of each value created by float('nan') as a different nan makes sense to my naive mind, and it also explains nicely the behavior present right now.
Not entirely:
x = float('NaN') y = x if x == y: ...
There it's hard to argue that the NaNs being compared result from different operations.
It does suggest a potential compromise, though: a single NaN object compares equal to itself, but different NaN objects are never equal (more or less what dict membership testing does now, but extended to all == comparisons).
Whether that's a sane compromise I'm not sure.
-- Greg
- Previous message: [Python-Dev] Why is nan != nan?
- Next message: [Python-Dev] Why is nan != nan?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]