[Python-Dev] Re: [Fwd: Discussion: Introducing new operators
formatrix computation]
Huaiyu Zhu
huaiyu_zhu@yahoo.com
Sat, 15 Jul 2000 02:54:13 -0700 (PDT)
On Sat, 15 Jul 2000, Fredrik Lundh wrote:
> > The only real danger is
> >
> > 3. + a
> > 3 .+ a
> >
> > But in this case pointwise operation does not make sense.
>
> really? what if "a" is a froob?
Really. Because 3 is a single point. It doesn't matter what a is.
> >>> print 3.+a()
> SyntaxError: sorry, that doesn't make sense. try inserting a space.
Why isn't this 3. + a()?
Hmm, I can see my bad habit of writing long posts so that they are often
quoted only partially. Here's the missing half:
So I suppose the following rules would resolve all the ambiguities:
Dot binds with preceding number. Otherwise it binds with following
operator. Otherwise it is a member indicator. Otherwise it is syntax error.
Examples:
2.+b
a.+b <-- only this is new
a.b
a.3
Huaiyu