[Python-Dev] Adding a Rational Type to Python

Moshe Zadka moshez@zadka.site.co.il
Mon, 12 Mar 2001 13:51:36 +0200 (IST)


On 12 Mar 2001 08:24:03 +0000, Michael Hudson <mwh21@cam.ac.uk> wrote:
 
> If "/" on integers returns a rational (as I presume it will if
> rationals get in as it's the only sane return type), then can we
> please have the default way of writing rationals as "p/q"?

That's proposed in a different PEP. Personally (*shock*) I'd like
all my PEPs to go in, but we sort of agreed that they will only
get in if they can get in in seperate pieces.
  
> Having ddd.ddd be a rational bothers me.  *No* langauge does that at
> present, do they?  Also, writing rational numbers as decimal floats
> strikes me s a bit loopy.  Is 
> 
>   0.33333333
> 
> 1/3 or 3333333/10000000?

The later. But decimal numbers *are* rationals...just the denominator
is always a power of 10.

> Certainly, if it's to go in, I'd like to see
> 
> > > Literals
> > > 
> > >     Literals conforming to the RE '\d*.\d*' will be rational numbers.
> 
> in the PEP as justification.
 
I'm not understanding you. Do you think it needs more justification, or
that it is justification for something?
-- 
"I'll be ex-DPL soon anyway so I'm        |LUKE: Is Perl better than Python?
looking for someplace else to grab power."|YODA: No...no... no. Quicker,
   -- Wichert Akkerman (on debian-private)|      easier, more seductive.
For public key, finger moshez@debian.org  |http://www.{python,debian,gnu}.org