PEP239 (Rational Numbers) Reference Implementation and new issues

Mark Day mday at apple.com
Fri Oct 4 20:52:55 EDT 2002


In article <ank8im$33l$0 at 216.39.172.122>, Bengt Richter <bokr at oz.net>
wrote:

> >Use of floating point values in such operations would either produce
> >errors:
> >
> >  1_3 + 2.5 -> TypeError
> Why? All floating point numbers can be viewed as exact rationals
> of the form n_<2**e>  with e>=0

Automatic conversion to rational pretends those float values are exact,
when they probably weren't meant that way.  I would prefer requiring an
explicit conversion rather than an implicit one.

Imagine the uproar when repr(R(1.0/3.0)) looks nothing like
repr(R(1,3)).

-Mark



More information about the Python-list mailing list