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

Ron Adam rrr at ronadam.com
Sun Aug 8 05:17:51 CEST 2010

On 08/07/2010 02:12 AM, Greg Ewing wrote:
> I've been doing some more hacking, and I now have a
> working implementation of cofunctions, which I'll
> upload somewhere soon.
> I have also translated my yield-from examples to
> use cofunctions. In the course of doing this, the
> additional restrictions that cofunctions impose have
> already proved their worth -- I forgot a cocall, and
> it clearly told me so and pointed out exactly where
> it had to go!

Would it be even remotely possible...

... to write a co-function program in a way where it could be switched from 
cooperative multitasking to preemptive multitasking by the use of a single 
flag? (I'd be +10,000 for this.)

If so, it would enable a way to hide a lot of details of multi-tasking and 
multi-processing in a convenient to use api.

No I haven't thought it though all that far.  But it seems to me it might 
be able to work if generators could work in a suspend before yield, instead 
of a suspend after yield mode.

Ideally pie in the sky,

Hey, this is the idea list after all. ;-)

More information about the Python-ideas mailing list