All NaNs are unequal, but some are more unequal than others
cdyson37 opened this issue · comments
cdyson37 commented
Suggestion for a wat:
nan = float("nan")
print (nan == nan) # False
print ({1 : nan} == {1 : nan}) # True
print ({1 : nan} == {1 : float("nan")}) # False
Christopher Night commented
That's great. Looks like it works for lists too. I added it to the section on NaN-related wats. Thanks!
cdyson37 commented
I love it! Could possibly provide a hint as to why we have this behaviour by pointing out that "x is x" but "x != x" (and it's the internal assumption that the former implies the latter that's the problem). But that might detract from the beauty of the wat :)
EDIT: You did that already in explanation.md - ignore me!