[Python-ideas] Cofunctions: It's alive! Its alive!

Nick Coghlan ncoghlan at gmail.com
Sun Aug 8 02:20:54 CEST 2010


On Sun, Aug 8, 2010 at 12:51 AM, Guido van Rossum <guido at python.org> wrote:
> On Sat, Aug 7, 2010 at 3:05 AM, Carl M. Johnson
> <cmjohnson.mailinglist at gmail.com> wrote:
>> Of course, as we all know on the OS side of things, cooperative
>> multitasking has been more or less phased out [...]
>
> I don't think you can see this as reflecting badly on cooperative
> multitasking. Rather, it is now understood better and has moved
> entirely to user space, leaving the OS to deal with preemptive
> threads, which cannot work well without OS support. As an example of
> cooperative multitasking being alive and well, see Stackless,
> Greenlets, and, in fact, coroutines built out of generators (possible
> in Python 2.5 and later).

Even simpler: GUI event loops are fundamentally about cooperative
multi-tasking. To me, the cofunction idea is really about making it
easier to write event loop code.

I think PEP 380 works well on its own, but will work better when
paired with a separate cofunctions PEP (similar to how PEP 342 and PEP
343 were best considered as a pair of co-proposals that went together,
even though they were technically independent of each other).

Cheers,
Nick.

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



More information about the Python-ideas mailing list