
On Sat, Oct 29, 2011 at 8:15 AM, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
Mark Shannon wrote:
Stackless provides coroutines. Greenlets are also coroutines (I think).
Lua has them, and is implemented in ANSI C, so it can be done portably.
These all have drawbacks. Greenlets are based on non-portable (and, I believe, slightly dangerous) C hackery, and I'm given to understand that Lua coroutines can't be suspended from within a C function.
My proposal has limitations, but it has the advantage of being based on fully portable and well-understood techniques.
The limitation of Lua style coroutines is that they can't be suspended from inside a function implemented in C. Without greenlets/Stackless style assembly code, coroutines in Python would likely have the same limitation. PEP 3152 (and all generator based coroutines) have the limitation that they can't suspend if there's a *Python* function on the stack. Can you see why I know consider this approach categorically worse than one that pursued the Lua approach? Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia