[issue1682] Move Demo/classes/Rat.py to Lib/rational.py and fix it up.

Mark Dickinson report at bugs.python.org
Sat Feb 2 14:19:00 CET 2008


Mark Dickinson added the comment:

About Rational('3.') and Rational('.2'):

It's not so much to do with consistency with float and Decimal;  more to do 
with the fact that some people like to write floats these ways (which 
presumably is why float and Decimal allow such input).

It occurs to me that if you also allow things like Rational('1e+100') then 
conversions from Decimal to Rational could simply be spelled

Rational(str(decimal_instance))

eliminating the need for the special Decimal -> Rational conversion method.

Anyway, I'll change the regex to allow '3.' and '.3'.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1682>
__________________________________


More information about the Python-bugs-list mailing list