Whether someone would choose Lua or Stackless Python for coroutines is
probably a matter of preference for the language itself. But one
thing Stackless might provide that Lua does not, is the ability to
block C function calls as well as Python function calls given that we
shift C stack sections in and out with tasklets. Or the ability to
persist and unpersist in a cross platform way, running tasklets.
True C coroutine semantics mean you can yield from a coroutine across a C call boundary and resume back to it.
Coco allows you to use a dedicated C stack for each coroutine. Resuming a coroutine and yielding from a coroutine automatically switches C stacks, too.
In particular you can now:
Best of all, you don't need to change your Lua or C sources and still get the benefits. It's fully integrated into the Lua core, but tries to minimize the required changes."""