[Python-Dev] == on object tests identity in 3.x
Anders J. Munch
2014 at jmunch.dk
Tue Jul 8 16:10:59 EDT 2014
Steven D'Aprano wrote:
> - Dropping reflexivity preserves the useful property that NANs compare
> unequal to everything.
Please present an example from real life where that turned out useful, and earn
yourself a beer!
I've only experienced examples to the contrary.
> - Keeping reflexivity for NANs would have implied some pretty nasty
> things, e.g. if log(-3) == log(-5), then -3 == -5.
>>> log(-3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: math domain error
You were perhaps referring to the log functions in C and Fortran, not math.log?
The tradeoffs are different in those languages, so choices the IEEE-754
committee made with C and Fortran in mind may be less relevant for Python.
regards, Anders
More information about the Python-list
mailing list