Securing a future for anonymous functions in Python

Nick Coghlan ncoghlan at
Thu Jan 6 06:02:43 EST 2005

Paul Rubin wrote:
> Nick Coghlan <ncoghlan at> writes:
>>Do you consider generator expressions or list comprehensions deficient
>>because they don't allow several statements in the body of the for
> I don't see what it would mean to do otherwise.

Exactly the same as a suite would in the innermost portion of the equivalent 
explicit generator (i.e. where the implicit "yield <expr>" currently ends up).

If you could put a suite inside a function expression (i.e. replacing the 
implicit "return <expr>") why not inside generator expressions as well?


Nick Coghlan   |   ncoghlan at   |   Brisbane, Australia

More information about the Python-list mailing list