|
|
|
|
|
by silentbicycle
5731 days ago
|
|
While I'm not current on the newest version of Python (I switched to Lua around py 2.5), Python generators had some functional limitations - most notably, they could only yield from their main body, not from within function calls, IIRC. Those issues struck me as kind of arbitrary, but were due to how Python interacts with the C stack. Lua's coroutines don't have those restrictions. I think Stackless Python doesn't have them either (though I haven't used it). Lua is also "stackless" in that sense. Also, Lua's coroutine.yield is a library function, not a keyword. I'm not convinced coroutines/continuations are a good fit for managing web state, but they do make a lot of other control flow situations easier to manage - "who has the main loop" problems are a non-issue, since they can have an independent main loop. |
|