
Oct. 27, 2011
6:39 a.m.
Greg Ewing wrote:
Mark Shannon wrote:
Why not have proper co-routines, instead of hacked-up generators?
What do you mean by a "proper coroutine"?
A parallel, non-concurrent, thread of execution. It should be able to transfer control from arbitrary places in execution, not within generators. Stackless provides coroutines. Greenlets are also coroutines (I think). Lua has them, and is implemented in ANSI C, so it can be done portably. See: http://www.jucs.org/jucs_10_7/coroutines_in_lua/de_moura_a_l.pdf (One of the examples in the paper uses coroutines to implement generators, which is obviously not required in Python :) ) Cheers, Mark.