Co-routines

Brian Kelley bkelley at wi.mit.edu
Thu Jul 17 12:18:29 EDT 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:

http://www-106.ibm.com/developerworks/opensource/library/l-pythrd.html?dwzone=opensource

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 mailing list