[Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issues
Thomas Wouters
thomas@xs4all.net
Tue, 8 Oct 2002 15:55:49 +0200
On Tue, Oct 08, 2002 at 08:41:31AM -0400, Paul Hughett wrote:
> Greg Ewing wrote:
> > So, I'm now reduced to suggesting
>
> > <2/3>
> How about 2r3, which could be pronounced "2 rational 3" and is syntactically
> very similar to the universal 2e3?
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. Who do we expect to use rationals ? Is it something we want
newbies to learn ? Will high/grade-school students with not compsci/math
background to recognize the e-notation be using rationals ? I'm not going
all happy-dayzy about rationals in the first place, but I know that is
because I understand the implementation and tradeoffs of floating point, and
they are what I want :)
I'd also say rational-literals are not that important. Looking at my own
Python code, I very rarely need a floating-point literal to start with.
Strings, plenty, dicts and lists fairly often, integers every now and then,
but floating point numbers very rarely, and almost all of them are just
'0.0' or an integer expressed as float to force float-division. Most of my
float objects come from (library) functions that return them.
If we expect newbies to prefer rationals over fp, we need syntax that is
clear to them (which may very well be just 'rat()'.) If we expect hard-core
mathers like Tim and Moshe and Chris Tismer and even Guido to use them, I'd
say we don't need syntax support for them and can just live with rat().
And I have to say some of the proposals for literal rationals I saw were
very disturbingly sick. Some of you need help, and some need to spend less
time using XML :-)
Beautiful-is-better-than-ug'ly y'rs,
--
Thomas Wouters <thomas@xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!