PEP239 (Rational Numbers) Reference Implementation and new issues

Alex Martelli aleax at aleax.it
Thu Oct 3 08:34:27 CEST 2002


Chris Gonnerman wrote:
        ...
> I agree,
> 
>     1/3
> 
> is pretty nice as a rational literal; but would it hurt
> so much to say
> 
>     1/3R
> 
> instead?

No, it wouldn't hurt much (though I'd spell it with a lowercase r -- I 
think that would make it more readable).  A trailing d could specify
decimal, a trailing L (normally uppercase for legibility) long -- the
latter should be extended to literals such as:
        1e7L
meaning the same as 10000000L -- it's silly to force the author AND
every reader of the source to count out zeroes carefully whenever
such integral literal amounts must be expressed.  That's not so crucial
anymore for Italians, now that we've switched from liras to euros,
but, for example, Turkey still uses their own liras, and they're
inflated enough that 1e7L Turkish liras is a few US $...


Alex




More information about the Python-list mailing list