Message83950
Urk. That patch produces horrible results when comparing Fractions and
Decimals:
Python 2.7a0 (unknown, Mar 21 2009, 17:59:48)
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from fractions import Fraction
>>> from decimal import Decimal
>>> Decimal('2.5') == Fraction(5, 2)
True
>>> Decimal('1.1') == Fraction(11, 10)
False
Either both results should be True (if comparisons between Fractions and
Decimals work numerically), or both should be False (refuse to
compare Fraction and Decimal).
It looks like what happens is that the Fraction comparison converts the
second argument to float before comparing. I'm tempted to call this a
bug in Fraction.__eq__. |
|
Date |
User |
Action |
Args |
2009-03-21 20:37:20 | mark.dickinson | set | recipients:
+ mark.dickinson, rhettinger, facundobatista, jdunck, lorg |
2009-03-21 20:37:20 | mark.dickinson | set | messageid: <1237667840.45.0.825973851487.issue2531@psf.upfronthosting.co.za> |
2009-03-21 20:37:18 | mark.dickinson | link | issue2531 messages |
2009-03-21 20:37:17 | mark.dickinson | create | |
|