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

David Abrahams dave@boost-consulting.com
07 Oct 2002 22:29:21 -0400


Guido van Rossum <guido@python.org> writes:

> > I liked 2r/3 because it gives the sense that r/ is the rational
> > division operator, where // is the whatever-the-hell-it-is division
> > operator. I don't know if it works in the grammar to be able to say
> >   
> >   x r/ y
> > 
> > though. Does it?
> 
> That would require changes to the tokenizer.
> 
> But I am against r/ on different grounds: it's not the kind of
> grouping of symbols that one would expect.  People are used to 12L, 1j
> and then it's a small step to 2r.  

You're right. And now that I look at it, if 2r is a rational with
value 2, and if you can divide ints by rationals, then 1/2r makes a
lot of sense. I wasn't looking at it that way (but I am now, and
liking it).

> There were also precedents for
> r"..." and u"...": C's w"...".  If you want a precedent for 2/, you'd
> have to search in Lisp or Forth or other (nearly) grammar-less
> languages.

Oh, please, don't remind me about those funky Forth symbols. I guess
it has less to do with grammar than with lexemes, though.

-- 
           David Abrahams * Boost Consulting
dave@boost-consulting.com * http://www.boost-consulting.com