Question about Python-Grammar
Bernhard Herzog
bh at intevation.de
Mon Jun 16 08:48:21 EDT 2003
Roman Meisl <roman at syxx.de> writes:
[about Python's Grammar]
> import_stmt: 'import' dotted_as_name
> dotted_as_name: dotted_name [NAME NAME]
> dotted_name: NAME ('.' NAME)*
>
> which makes following import-statement possible:
> import NAME NAME NAME
>
> What's the sense of this statement? Or is this an error in the
> grammar?
>
> (Even the compiler (2.2.2) claims a syntax error when parsing
> "import mod1 mod2 mod3" )
But not for "import mod1 as mod2".
The "as" in there is not a keyword and thus can't be in the Grammar
explicitly AFAIK so constraining "import NAME NAME NAME" to cases where
the second NAME is "as" is done by the compiler.
Bernhard
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://www.mapit.de/
More information about the Python-list
mailing list