A rational proposal

Mike Meyer mwm at mired.org
Wed Dec 22 17:15:23 EST 2004


Nick Coghlan <ncoghlan at iinet.net.au> writes:

> Actually, I was misremembering how Decimal worked - it follows the rule you suggest:
>
> float() + Decimal() fails with a TypeError
> float() + float(Decimal()) works fine
>
> And I believe Decimal's __float__ operation is a 'best effort' kind of
> thing, so I have no problem with Rationals working the same way.

Actually, I suggested that:

float() + Rational() returns float

You're suggesting that the implicit conversion to float not happen
here, and the user be forced to cast it to float? And you're saying
Decimal does it that way.[

That's good enough for me.

       <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list