[issue2531] float compared to decimal is silently incorrect.
Mark Dickinson
report at bugs.python.org
Sun Mar 14 12:52:35 CET 2010
Mark Dickinson <dickinsm at gmail.com> added the comment:
Here's a patch:
- comparisons between a Decimal and float produce a result based
on the numeric values of the Decimal and float
- change Decimal.__hash__ so that floats and Decimals with (exactly)
equal value have the same hash. This preserves the rule that if
two objects compare equal then they hash equal.
- add tests, and update documentation.
Still open: should this change be forward ported to py3k? If not, then these comparisons should produce a DeprecationWarning.
----------
Added file: http://bugs.python.org/file16544/issue2531.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2531>
_______________________________________
More information about the Python-bugs-list
mailing list