[Python-Dev] Simple generators, round 2
Neil Schemenauer
nas@arctrix.com
Sat, 24 Mar 2001 21:47:48 -0800
On Sun, Mar 25, 2001 at 12:07:20AM -0500, Tim Peters wrote:
> If you give me a coroutine program, and let me add a "control
> loop", ...
This is exactly what I started doing when I was trying to rewrite
your Coroutine.py module to use generators.
> A. Simple to implement in CPython without threads, and at least
> possible likewise even for Jython.
I'm not sure about Jython. The sys._getframe(), frame.suspend(),
and frame.resume() low level interface is nice. I think Jython
must know which frames are going to be suspended at compile time.
That makes it hard to build higher level control abstractions. I
don't know much about Jython though so maybe there's another way.
In any case it should be possible to use threads to implement
some common higher level interfaces.
Neil