Stefan Krah <stefan-usenet <at> bytereef.org> writes:
>
> Are there cases where == and != are actually needed to give a result
> for NaNs?
It is a common expectation that == and != always succeed. They return True or
False, but don't raise an exception even on unrelated operands:
>>> b"a" == "a"
False
>>> "5" == 5
False
>>> {} == 0.0
False
>>> None == (lambda x: 1)
False
>>> int == max
False
The only place I know of where this expectation isn't met is when comparing
"naive" and "timezone-aware" datetime objects, which raises a TypeError (IIRC).
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com