bkelley at wi.mit.edu
Thu Jul 17 18:18:29 CEST 2003
> There is a 'Flow' module in Twisted which uses generators to
> accomplish this sort of thing. Basically, Twisted has a
> queue of functions that are called, and by yielding "cooperate"
> object, you re-schedule the given generator for execution
> on this queue (allowing other code blocks to execute).
Check out this article:
on weightless threads, a simpler version of "Flow"
Now, my question is, could an arbitrary function's bytecode be liberally
sprinkled with "yeilds" at run-time to achieve this effect without
having to alter the source code?
More information about the Python-list