Mark Dickinson <dicki...@gmail.com> added the comment:

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__.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue2531>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to