Most "active" coroutine library project?
invalid at invalid.invalid
Wed Sep 23 22:58:49 CEST 2009
On 2009-09-23, exarkun at twistedmatrix.com <exarkun at twistedmatrix.com> wrote:
> On 08:16 pm, sajmikins at gmail.com wrote:
>>On Wed, Sep 23, 2009 at 2:05 PM, <exarkun at twistedmatrix.com> wrote:
>>>But what some Python programmers call coroutines aren't really the
>>>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
> 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
http://www.sics.se/~adam/pt/) 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