Microthreads without Stackless?

bwm at acm.org bwm at acm.org
Thu Sep 23 16:48:16 CEST 2004

> The point I got from Bernhard Mulder's recipe is how to yield
> from any call depth.  His method is to re-write every call chain
> that leads to a yield, so that every function is a generator and
> every call is in a for loop....
> That's the kind of solution I was discounting when I wrote,
> "Importantly, I do *not* have to re-write all the functions in
> every call chain that leads to a read or write".
In Python 2.4, you could use a decorator to convert a routine into a

With a Metaclass, you could do this "decoration" automatically for all

As for call chains, maybe you could define a Metaclass which converts
calls via some byte-code voodoo into for loops.

More information about the Python-list mailing list