Most "active" coroutine library project?
Grant Edwards
invalid at invalid.invalid
Wed Sep 23 16:58:49 EDT 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:
>>[snip]
>>>
>>>But what some Python programmers call coroutines aren't really the
>>>same as
>>>what the programming community at large would call a coroutine.
>>>
>>>Jean-Paul
>>
>>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
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!
visi.com
More information about the Python-list
mailing list