a = b = 1 just syntactic sugar?

Ed Avis ed at membled.com
Mon Jun 9 02:49:33 EDT 2003


martin at v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) writes:

>>I've given several examples, a possible grammar rule (use simple_stmt)
>>and a semantics (the same as a named def).
>
>That would be an incompatible change. Currently
>
>x = lambda:2
>print x()
>
>prints "2".

Sorry, what I meant was, the semantics is the same as a named def for
the constructs that are added to the language.  Lambda-functions which
were legal before the change keep the same meaning.  This could be
implemented by adding an implicit 'return' if the body of the function
is an expression_stmt.

-- 
Ed Avis <ed at membled.com>




More information about the Python-list mailing list