[issue8188] Unified hash for numeric types.

Mark Dickinson report at bugs.python.org
Sat Mar 27 12:49:29 CET 2010


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

Here's a version of the patch that adds exact comparisons between the various numeric types.  The only slightly tricky comparison is the Fraction <-> Decimal one:  an obvious strategy is to convert the Decimal exactly to a Fraction and then use the fraction comparison, but this is inefficient for Decimal instances with large exponent.  So instead, we compare a Decimal `x` with a Fraction `n/d` by comparing `x*d` with `n` in the Decimal domain.

----------
Added file: http://bugs.python.org/file16675/numeric_hash5.patch

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


More information about the Python-bugs-list mailing list