Most "active" coroutine library project?
Simon Forman
sajmikins at gmail.com
Fri Sep 25 12:21:42 EDT 2009
On Fri, Sep 25, 2009 at 11:42 AM, Grant Edwards <invalid at invalid.invalid> wrote:
> On 2009-09-25, Piet van Oostrum <piet at cs.uu.nl> wrote:
>>>>>>> exarkun at twistedmatrix.com (e) wrote:
>>
>>>e> I specifically left out all "yield" statements in my version, since that's
>>>e> exactly the point here. :) With "real" coroutines, they're not necessary -
>>>e> coroutine calls look just like any other call. With Python's enhanced
>>>e> generators, they are.
>>
>> The first time I encountered coroutines was in Simula-67. Coroutine
>> switching was certainly explicit there. IIRC, the keyword was resume.
>
> I'm not sure exactly what "coroutine calls" refers to, but the
> "mis-feature" in Python co-routines that's being discussed is
> the fact that you can only yeild/resume from the main coroutine
> function.
>
> You can't call a function that yields control back to the other
> coroutine(s). By jumping through some hoops you can get the
> same effect, but it's not very intuitive and it sort of "feels
> wrong" that the main routine has to know ahead of time when
> calling a function whether that function might need to yield or
> not.
You mean a "trampoline" function? I.e. you have to call into your
coroutines in a special main function that expects as part of the
yielded value(s) the next coroutine to pass control to, and your
coroutines all need to yield the next coroutine?
~Simon
More information about the Python-list
mailing list