[Python-ideas] Cofunctions - Back to Basics

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Oct 29 08:48:41 CEST 2011


Ron Adam wrote:

> Another issue with this is, the routines and the framework become tied
> together.  The routines need to know the proper additional protocol to
> work with that framework, and they also can't be used with any other
> framework.

An interesting thing about yield-from is that once you have
it, the interface between the generators and the framework
reduces to the iterator protocol, and there's really only
*one* obvious way to do it.

This means it may become feasible to have a single coroutine
scheduler in the standard library, with hooks for adding
various kinds of event sources, so that different libraries
handling asynchronous events can work together, instead of
each one wanting to be in charge an run its own event
loop.

-- 
Greg



More information about the Python-ideas mailing list