Why not 3.__class__ ?
Alex Martelli
aleax at aleax.it
Mon Sep 17 09:03:39 EDT 2001
"Marcin 'Qrczak' Kowalczyk" <qrczak at knm.org.pl> wrote in message
news:slrn9qbrg8.m76.qrczak at qrnik.zagroda...
> Mon, 17 Sep 2001 10:02:25 +0200, Alex Martelli <aleax at aleax.it> pisze:
>
> > But tokenizing "3.whatever" as anything different from a "3." token
> > followed by a "whatever" token would break backwards compatibility
>
> Is there any case in the grammar when a literal is directly followed
> by an identifier?
Not AFAIK (the 'as' not-a-keyword trick, at least as extended so
far, does not immediately follow a literal).
But, of course, we do *NOT* want to have the tokenizer "ask"
higher levels for guidance -- that's the same kind of madness
one finds e.g. in C, where a tokenizer must typically know
about typenames and thus must ask higher grammar levels for
guidance. No circular dependencies, please.
I'd much rather keep the possibility of other uses of not-quite-
a-keyword tricks in the future, than distort the lexing and
parsing architecture for the sake of allowing 3.__class__ to
be written without a space, parentheses, etc.
Alex
More information about the Python-list
mailing list