python and macros (again) [Was: python3: 'where' keyword]

Antoon Pardon apardon at forel.vub.ac.be
Fri Jan 14 05:46:07 EST 2005


Op 2005-01-14, Nick Coghlan schreef <ncoghlan at iinet.net.au>:
> Antoon Pardon wrote:
>> No I am applying set logic. Any string that is in the set of
>> valid expressions is also in the set of valid statements.
>
> According to Python's grammar, this is not the case. It requires a NEWLINE or 
> ";" token on the end to turn the expression into a statement. Actually appending 
> either of those tokens means the string is no longer an expression.

Well you are correct, but by the same logic an expression_stmt isn't a
statement either. In point of fact none of the <specifics>_stmt is a
statement including an assignment.

But changing "statements" to "simple statements" seems to make
the assertion correct.

-- 
Antoon Pardon



More information about the Python-list mailing list