Numeric methods again

Magnus Lie Hetland mlh at idi.ntnu.no
Wed Jul 25 08:39:23 EDT 2001


Now that Python seems to be getting numerig methods
(like "5 .__add__" etc.) I'm pretty happy about that.
But I find it odd that there has to be whitespace
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? Is there any way
that 5._ is not the beginning of a reference to a
numeric method? Can a number ever be directly followed
by an identifier? Is the parser to weak to parse this
stuff? Am I just being dense?

This definitely looks like a (little) wart to me...

(I'm sure I should RTFM here - but I've looked through
the PEPs and haven't found this in there...)

--

  Magnus Lie Hetland         http://www.hetland.org

 "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