[Python-Dev] generator/microthread syntax

Greg Ewing greg at cosc.canterbury.ac.nz
Tue Nov 18 19:27:59 EST 2003


Wade Brainerd <wade at treyarch.com>:

> Instead, subroutines with a wait_ prefix execute yield 
> statements which are automatically propogated up the call stack all the 
> way to the thread manager. 
> 
> Is there anything to be done about this in Python?

Python generators aren't really designed for use as general-purpose
coroutines, and trying to use them as such is messy.

You might like to investigate Stackless Python, which has real
microthreads that *are* designed for the sort of thing you're
doing.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list