What's do list comprehensions do that generator expressions don't?

Reinhold Birkenfeld reinhold-birkenfeld-nospam at wolke7.net
Tue Apr 26 14:48:10 EDT 2005


Mike Meyer wrote:

> The question under these circumstances is then: do you want bare
> genexp to mean something? Right now, it's a syntax error. But there's
> no reason you couldn't have:
> 
>    y = x for x in stuff

I like

y = (x for x in stuff)

as it is, it's way more readable.

Reinhold



More information about the Python-list mailing list