[Python-ideas] Cofunctions - Back to Basics

Nick Coghlan ncoghlan at gmail.com
Sat Oct 29 04:10:43 CEST 2011


On Sat, Oct 29, 2011 at 8:40 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> Greg Ewing wrote:
>>
>> Mark Shannon wrote:
>>
>>> Stackless provides coroutines. Greenlets are also coroutines (I think).
>>>
>>> Lua has them, and is implemented in ANSI C, so it can be done portably.
>>
>> These all have drawbacks. Greenlets are based on non-portable
>> (and, I believe, slightly dangerous) C hackery, and I'm given
>> to understand that Lua coroutines can't be suspended from
>> within a C function.
>>
>> My proposal has limitations, but it has the advantage of
>> being based on fully portable and well-understood techniques.
>
> If Stackless has them, could we use that code?

That's what the greenlets module *is* - the coroutine code from
Stackless, lifted out and provided as an extension module instead of a
forked version of the runtime.

Cheers,
Nick.

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



More information about the Python-ideas mailing list