[Python-Dev] continuations for the curious

Christian Tismer tismer@appliedbiometrics.com
Sat, 24 Jul 1999 01:36:33 +0200


Howdy,

my modules are nearly ready. I will be out of my office
for two weeks, but had no time to finalize and publish yet.
Stackless Python has reached what I wanted it to reach:
A continuation can be saved at every opcode.

The continuationmodule has been shrunk heavily.
Some extension is still needed, continuations
are still frames, but they can be picked like
Sam wanted it originally.

Sam, I'm pretty sure this is more than enough for
coroutines. Just have a look at getpcc(), this is
now very easy. All involved frames are armed so that
they *can* save themselves, but will do so just if
necessary. The cheapest solution I could think of,
no other optimization is necessary. If your coroutine
functions like to swap two frames, and if they manage to
do so that the refcount of the target stays at one,
no extra frame will be generated.
That's it, really.

If someone wants to play, get the stackless module, replace
ceval.c, and build continuationmodule.c as a dll or whatever.

testct.py contains a lot of crap. The first implementation
of class coroutine is working right.
The second one is wrong by concept.

later - chris

ftp://ftp.pns.cc/pub/veryfar.zip

-- 
Christian Tismer             :^)   <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home