On Thu, Aug 1, 2013 at 7:20 AM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > I know this, and that's not what surprised me. What surprised me was that > Fraction converts the float to a fraction, then compares. It surprises me > because in other operations, Fractions down-cast to float. > > Adding a float to a Fraction converts the Fraction to the nearest float, > then adds: > > py> 1/3 + Fraction(1, 3) > 0.6666666666666666
Hmm. This is the one that surprises me. That would be like the addition of a float and an int resulting in an int (at least in C; in Python, where floats have limited range and ints have arbitrary precision, the matter's not quite so clear-cut). Perhaps this needs to be changed? ChrisA -- http://mail.python.org/mailman/listinfo/python-list