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

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Fri Jan 14 11:40:29 EST 2005


Antoon Pardon wrote:
> IMO we have a: dogs are mamals kind of relationship in Python.

I see what you mean, but I don't think it's true.

> Every expression can be used where a statement is expected.
> (And this can be worded as: every expression is a statement.)

Not really. An expression statement is a statement that looks like an 
expression, but actually it's more than that: not only does it calculate 
the value of the expression, it also prints the value.

Note that it would be perfectly possible to modify the syntax into

expression_stmt ::= "exprstmt" expression_list

so that you would have to write

exprstmt 6*9

instead of just

6*9

That makes it clearer to see the distinction: 6*9 is an expression,

exprstmt 6*9

is a statement. An expression statement, more precisely.

> Not every statement can be used where an expression is expected. 

AFAIK *no* statement can be used where an expression is expected.

-- 
"Codito ergo sum"
Roel Schroeven



More information about the Python-list mailing list