[Python-ideas] Cofunctions - Back to Basics

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Oct 29 09:21:36 CEST 2011


Nick Coghlan wrote:

> If you can't merge the synchronous and asynchronous version of your
> I/O routines, it means you end up having to write everything in the
> entire stack twice - once in an "event loop friendly" way ... and
 > once in the normal procedural way.

Okay, I understand what you're concerned about now. Yes,
that's a nuisance, and it would be very nice to be able to
avoid it.

Unfortunately, I don't know how to implement your suggestion
in a fully general way without either resorting to dubious
C-level hackery as greenlets do, or turning the entire
architecture of CPython inside out as the original version
of Stackless did.

What I'm trying to do is see how close I can get to the
ideal, without hackery, by building on already-established
mechanisms in CPython and making as few changes as possible.

-- 
Greg




More information about the Python-ideas mailing list