[Python-Dev] PEP 380 (yield from a subgenerator) comments

Steve Holden steve at holdenweb.com
Fri Mar 27 08:09:25 CET 2009

Greg Ewing wrote:
> Guido van Rossum wrote:
>> (Well here is Greg's requested use case for .send(). :-)
> There was a complaint that my return-value-with-send
> example was too much of a coroutine scenario, so I
> was hoping to find something un-coroutine-like. But
> if coroutines are the main uses for send in the first
> place, then it seems my example is fine as it is.
> BTW, I've thought of an answer as to why one would
> want to write a parser using send(). In the non-send()
> version I had to make the scanner a global variable
> in order to avoid passing it around among all the
> parsing functions. The send() technique avoids having
> to do either of those things.
Someone pointed out in my tutorial today that the circuits module makes
heavy use of the generators' two-way communications capability. Maybe of
you looked at the code you would find low-hanging fruit you could pick
for sensible use cases.

Steve Holden           +1 571 484 6266   +1 800 494 3119
Holden Web LLC                 http://www.holdenweb.com/
Want to know? Come to PyCon - soon! http://us.pycon.org/

More information about the Python-Dev mailing list