a = b = 1 just syntactic sugar?

Martin v. Löwis martin at v.loewis.de
Sun Jun 8 02:37:25 EDT 2003


Ed Avis <ed at membled.com> writes:

> I'm not trying to attack the distinction between expressions and
> statements.  I know better than to do that.  I am just asking, why is
> it that the body of an anonymous function cannot contain statements?

Because nobody can think of a clear, intuitive, and implementable
grammar specification that allows otherwise.

> Elsewhere in this thread I proposed using a simple_stmt as the body of
> a lambda.  Still, if you say there has been years of discussion I am
> not so foolish as to think I've found the answer.

Then your examples don't follow your proposal. A simple_stmt ends with
a NEWLINE, whereas you did not put a newline at the end of the
statement in your examples.

Regards,
Martin




More information about the Python-list mailing list