[Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issues

Christopher A. Craig list-python@ccraig.org
09 Oct 2002 10:16:46 -0400


Tim Peters <tim.one@comcast.net> writes:

> 2/3r works for both for me.  0.666...7 doesn't work for me at all as
> a stringification of a rational (if I want to approximate, I'll ask
> for an approximation).

I agree.  I initially thought about returning a decimal with str(),
but for that reason chose not to.  It might be nice to have a method
that returned the best floating point decimal approximation to within
n decimal digits or shorter, but I don't want a builtin to make an
arbitrary decision on where to cut off precision.

I do like the idea of str() returning the form 5+3/2r, though.

-- 
Christopher A. Craig <list-python@ccraig.org>
Python is an excellent language for learning object orientation. (It also
happens to be my favorite OO scripting language.)
Sriram Srinivasan -- "Advanced Perl Programming"