Securing a future for anonymous functions in Python

Nick Coghlan ncoghlan at iinet.net.au
Thu Jan 6 12:02:43 CET 2005


Paul Rubin wrote:
> Nick Coghlan <ncoghlan at iinet.net.au> writes:
> 
>>Do you consider generator expressions or list comprehensions deficient
>>because they don't allow several statements in the body of the for
>>loop?
> 
> 
> 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?

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list