Question about Python-Grammar

W Isaac Carroll icarroll at
Mon Jun 16 22:53:57 CEST 2003

Bernhard Herzog wrote:
> Roman Meisl <roman at> writes:
>>which makes following import-statement possible:
>>What's the sense of this statement? Or is this an error in the
>>(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.

The basic idea here is that "as" ought to be a keyword in Python, but 
for historical reasons isn't. My understanding is that making it a 
keyword has been looked into and it would be more trouble than it's worth.


More information about the Python-list mailing list