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

Paul Hughett hughett@mercur.uphs.upenn.edu
Tue, 8 Oct 2002 10:56:34 -0400


Paul Hughett wrote:

>> How about 2r3, which could be pronounced "2 rational 3" and is syntactically
>> very similar to the universal 2e3?

Thomas Wouters wrote:

> 2e3 may be universal, I wouldn't say it's very universally used. I
> personally never use the e-notation, and I can't say I find it very
>readable

I think I was a bit misleading there.  I mentioned the similarity to 2e3
as an argument that it would be easy to modify the lexer and parser to
handle 2r3.  I doubt that we want to inflict that analogy on the learner;
if nothing else, they'd keep trying to interpret the 3 as an exponent.


> I'd also say rational-literals are not that important.

This may be the key decision.  Do we really need rational literals, or
can we live with constructors?  Using rat(2,3) seems fine to me as the
constructor, and I'm not all that enamoured of rational literals.  On
the other hand, I would hardly ever use rationals; I regard them as a
specialized tool akin to symbolic algebra (to which they are arguably
essential).  If we do want rational literals, well then 2r3 seems a
reasonably painless way to get them.


> If we expect newbies to prefer rationals over fp...

I don't.  I'd say the right thing for newbies is decimal floating point,
rather than rationals.  Not that I object to adding rationals to Python;
they're a specialized tool, but a powerful one within their niche.


Paul Hughett