Numeric methods again

Magnus Lie Hetland mlh at
Wed Jul 25 20:56:45 CEST 2001

"Martin von Loewis" <loewis at> wrote in message
news:j4ofq8hp0w.fsf at
> "Magnus Lie Hetland" <mlh at> writes:
> > in front of the reference dot... For a simple parser
> > it might be difficult to know whether 5. was a float
> > or the beginning of a reference, but with a bit of
> > lookahead that can't be too hard?
> If you want to allow "", you certainly also need to allow
> "5. foo", as you can also write "a. foo". So it requires arbitrary
> look-ahead.

I'm sure you didn't think I meant that "5. foo" should be outlawed?
I'm just surprised that it should be _required_.

And it would only require one token lookahead, as long as the scanner
compresses the whitespace... But, as I said, that's not the issue.

> > Can a number ever be directly followed by an identifier?
> Yes, certainly: "5.e17" could be either 5*10**17, or the e17 attribute
> of 5.

Right. I guess that's the problem, then. But since all the methods of
numeric constants begin with an underscore, that really ought not
to be a problem... Right?

> Regards,
> Martin

- Magnus, still wondering what the _real_ problem is...


  Magnus Lie Hetland

 "Reality is that which, when you stop believing in
  it, doesn't go away."           -- Philip K. Dick

More information about the Python-list mailing list