Antoine Pitrou wrote:
Andrey Popp wrote:
- 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.