[Python-Dev] Re: Graph exploration with generators

David Eppstein eppstein at ics.uci.edu
Mon Aug 18 22:00:26 EDT 2003

In article <3F419D09.5070709 at ieee.org>,
 "Shane Holloway (IEEE)" <shane.holloway at ieee.org> wrote:

>    I assume this loss is due to restoring each context in the chain.  (I 
>    would need help verifying this assumption.)
> What I would like to propose is a "yield *" type statement, where "yield 
> *collection" would have the equivalent 
> functionality of "for item in collection: yield item".  The above example 
> would then appear as follows:

It's been proposed before, with somewhat different syntax ("yield every" 
instead of "yield *"): http://tinyurl.com/kfvc

The syntax alone doesn't help speed things up, but iirc Greg Ewing had 
some good ideas for doing this efficiently.  I think the concensus was, 
though, that generators are so new that we haven't had enough experience 
to know what the best ways of using them are, so it would be premature 
to settle on chaining them this way.

David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science

More information about the Python-Dev mailing list