[issue10356] decimal.py: hash of -1

Mark Dickinson report at bugs.python.org
Fri Nov 19 12:12:19 CET 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

[Stefan]
> ... a direct request to raise an exception...

Understood;  the issue is that this conflicts with the general expectation that equality (and inequality) comparisons always work (at least, for objects that are perceived as immutable).  I think there needs to be a very good reason to have an equality comparison raise an exception, and I don't find this particular reason good enough.  The expected IEEE 754 semantics are still available through the published API:  e.g., using Decimal.compare instead of '=='.

So I'd lean towards having '==' follow Python rules rather than IEEE 754 rules in this case, with Decimal.compare available for the times when the IEEE 754 rules are important.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10356>
_______________________________________


More information about the Python-bugs-list mailing list