[Python-ideas] Cofunctions - Back to Basics

Nick Coghlan ncoghlan at gmail.com
Sun Oct 30 23:40:01 CET 2011


On Mon, Oct 31, 2011 at 8:12 AM, Matt Joiner <anacrolix at gmail.com> wrote:
> +10 for greenlet style coroutines. It's a very modern feature and will put
> python in an excellent position. Also nick your points about asynchronous io
> being the main use case are spot on as far as I'm concerned.

This whole thread has been very helpful to me in understanding not
only why I think Greg's coroutine PEP is important, but also why the
whole generators-as-coroutines paradigm feels so restrictive.

It means we basically have two potential paths forward:

1. Stackless Python (aka greenlets).
   Pros: known to work for a large number of use cases
   Cons: need to define a mechanism to declare that the C stack is
being used in a "coroutine friendly" fashion

2. Implicit creation of generator-style suspendable frames
   Pros: shouldn't need assembly level hackery
   Cons: effectively requires duplication of every C level type slot
with a coroutine friendly equivalent that supports suspension

Cheers,
Nick.

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



More information about the Python-ideas mailing list