[Python-ideas] x=(yield from) confusion [was:Yet another alternative name for yield-from]

Nick Coghlan ncoghlan at gmail.com
Mon Apr 6 01:04:33 CEST 2009


Jim Jewett wrote:
> Almost exactly the opposite.  I can see cases where you want
> the interim yields, and I can see cases where you want the final
> result -- but I'm asking how common it is to need *both*, and
> whether we should really be going to such effort for it.
> 
> If you only need one or the other, I think the PEP can be greatly simplified.

One of the things you may want to use coroutines with is a trampoline
scheduler for handling asynchronous IO. In that case, the inner
coroutine may want to yield an IO wait object so the scheduler can add
the relevant descriptor to the main select() loop.

In such a case, the interim yielded values would go back to the
scheduler, while the final result would go back to the calling coroutine.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list