[Python-Dev] Re: [Fwd: Discussion: Introducing new operators formatrix computation]
Greg Stein
gstein@lyra.org
Fri, 14 Jul 2000 01:02:20 -0700
On Fri, Jul 14, 2000 at 09:44:12AM +0200, Thomas Wouters wrote:
> On Thu, Jul 13, 2000 at 10:53:38PM -0700, Huaiyu Zhu wrote:
> > On Thu, 13 Jul 2000, Paul Prescod wrote:
>
> > > It all depends on who works on it and how hard they work. I really can't
>
> > So can some one answer this question for sure:
>
> > Is it definitely possible to introduce .* ./ etc without much more
> > difficulty than introducing @* and @/ and so on?
>
> No, I don't think it's possible without significantly restructuring the
> Grammar. However, Vladimir may prove me wrong, he has before ! :-) The
> problem is the recursive-descent parser Python is using, I don't think it
> can see the difference between
The issue isn't with recursive-descent, and this would be a relatively easy
change. You would introduce a new token "./" to accomplish this (call it
DOTSLASH).
Thus, . / maps to (DOT, SLASH,) while ./ maps to (DOTSLASH,).
Python already does this to differentiate between < and <<. Most languages
do, actually.
What is really weird is that Python sees the ellipsis value/operator/
whatever-the-heck-it-is as three individual DOT tokens rather than a single
token. Thus, the following two statements are equal:
a[...]
a[. . .]
Whacky :-)
Cheers,
-g
--
Greg Stein, http://www.lyra.org/