[Python-ideas] checking for identity before comparing built-in objects
Stephen J. Turnbull
stephen at xemacs.org
Tue Oct 9 02:37:52 CEST 2012
Guido van Rossum writes:
> Sounds good. (But now maybe we also need to come clean with the
> exceptions for NaNs compared as part of container comparisons?)
For a second I thought you meant IEEE 754 Exceptions. Whew! How
about:
"""
For reasons of efficiency, Python allows comparisons of containers to
shortcut element comparisons. These shortcuts mean that it is
possible that comparison of two containers may return True, even if
they contain NaNs. For details, see the language reference[1].
"""
Longer than I think it deserves, but maybe somebody has a better idea?
Footnotes:
[1] Sorry about that, but details don't really belong in a *Python*
tutorial. Maybe this should be "see the implementation notes"?
More information about the Python-ideas
mailing list