Most "active" coroutine library project?

Grant Edwards invalid at invalid.invalid
Wed Sep 23 22:58:49 CEST 2009

On 2009-09-23, exarkun at <exarkun at> wrote:
> On 08:16 pm, sajmikins at wrote:
>>On Wed, Sep 23, 2009 at 2:05 PM,  <exarkun at> wrote:
>>>But what some Python programmers call coroutines aren't really the 
>>>same as
>>>what the programming community at large would call a coroutine.
>>Really?  I'm curious as to the differences.  (I just skimmed
>>the entry for coroutines in Wikipedia and PEP 342, but I'm not
>>fully enlightened.)
> The important difference is that coroutines can switch across
> multiple stack frames.  Python's "enhanced generators" can
> still only switch across one stack frame - ie, from inside the
> generator to the frame immediately outside the generator.

Good point.  Being unable to "yeild" from inside a function
called by the "main" coroutine can be limiting once you try to
do something non-trivial.  I had read about that limitation,
but had forgotten it.

Some "stackless" threading schemes for C (e.g. Protothreads have the same issue, and it does
require some extra effort to work around that limitation.

Grant Edwards                   grante             Yow! I have accepted
                                  at               Provolone into my life!

More information about the Python-list mailing list