[Python-ideas] [Python-Dev] yield * (Re: Missing operator.call)

Antoine Pitrou solipsis at pitrou.net
Tue Feb 10 03:12:47 CET 2009

Steven D'Aprano <steve at ...> writes:
> Since people are already choosing to use generator expressions instead 
> of unrolling them into for loops, I don't believe that your objection is 
> relevant to the proposal.

I don't know about other people, but when I write a generator expression, it's
usually for passing it around. That is, I write a generator expression in places
where I'd otherwise have to write a full generator function; both are probably
equivalent performance-wise.

I don't think writing a generator expression in situations where you could
simply inline the equivalent loop is very common, because it doesn't seem to
bring anything (and, as you observed, it's slower).



More information about the Python-ideas mailing list