NaN comparisons - Call For Anecdotes

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Jul 8 20:12:38 CEST 2014


On Tue, 08 Jul 2014 20:31:25 +0300, Marko Rauhamaa wrote:

> Thus, dict operations never test NaN == NaN

You're assuming that there is only one NAN instance. That is not correct:

py> a = float('nan')
py> b = float('nan')
py> a is b
False
py> a in {b: None}
False



-- 
Steven



More information about the Python-list mailing list