> Problem #2: There must be a bug in the parser (Guido?), because:
>
> >>> lambda l: (l[0], l[1] )([1,2]) # just yields the function
> <anonymous function at 20071a08>
The grammar states that the expression in a lambda is a 'test'.
Evidently, (l[0], l[1] )([1,2]) is a test. Surely you want to bew
able to write lambda's that contain a function call, right? Since
there's no rule that the expression of a lambda *has* to be enclosed
in parentheses, there also isn't a rule that if it starts with a left
parentheses then the expression contained in that pair of parentheses
is the whole lambda. Nevermond that it's semantically silly in this
particular case: the grammar can't help but allowing things like
"()()()"...
Concluding: if you want to call the lambda immediately you *always*
have to enclose the entire lambda form in parentheses.
--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>