[Python-ideas] Cofunctions PEP - Revision 4

Andrey Popp 8mayday at gmail.com
Sun Aug 15 15:36:30 CEST 2010


Antoine Pitrou wrote:
> Andrey Popp wrote:
>> 2) That will affect code reusability a lot, because we can't mix
>> cocalls and calls.
>>
>> All this issues are solved with greenlet library and I think if Python
>> needs cooperative threads they should have API and behave like
>> greenlets.
>
> As far as I understand, the only way Stackless and the like can make
> things "transparent" is that they monkey-patch core socket
> functionality (and perhaps other critical built-in functionalities).
> "Soft" cooperative multithreading isn't naturally transparent, which
> makes it quite different from OS-level multithreading.

Stackless does not monkey-patch socket, gevent and eventlet do, but
I'm not about that. We can just have another socket implementation
that cooperates and use it in cooperative code.

I'm about how to start coroutines and switch between them — the way
it's done in greenlet (but not the implementation) is more preferable
to explicit cocalls.

-- 
Andrey Popp

phone: +7 911 740 24 91
e-mail: 8mayday at gmail.com



More information about the Python-ideas mailing list