Mark Dickinson <[email protected]> added the comment:
Ah, now I remember: making sNaNs hashable has the potential to introduce
seemingly random exceptions with set and dict operations. The logic went
something like:
(1) if sNaNs are hashable, you can put them in dicts,
(2) operations on dicts make equality comparisons at (from the
user's POV) unpredictable times (i.e., when hashes of two
unequal objects happen to be equal), and
(3) equality comparisons involving sNaNs raise an exception.
I'm wondering whether we should revisit the decision to have sNaN equalities
raise an exception, and just have sNaN equality comparisons behave identically
to those for (Decimal or float) NaNs in 3.2.
At any rate, if the code is left as is, the above logic should be added to the
__hash__ function as a comment.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue10356>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com