[Stackless] interesting discussion on Scheme and continuations

Christian Tismer tismer at appliedbiometrics.com
Wed Oct 18 11:14:48 CEST 2000

Just van Rossum wrote:
> Thanks for those URL's! That sounds like an interesting thread with lots of
> relevance for Python continuations. Before I dive in there, a couple of
> comments.
> >>-- Matthias
> This seems to be about continuations. The questions need to be rephrased to
> be of relevance for stackless Python:
> 1. Are continuations neccesary to implement co-routines & uthreads?
> 2. Are continuations neccesary for Python?
> Answers:
> 1. No.
> 2. I honestly don't know...
> However, if the question was:
> 3. Is a stackless version of Python neccesary to implement
>    co-routines and uthreads?
> ..the answer would of course be "yes".

With a sufficiently carful definition of "continuation", things
can be turned upside down: We can identify certain kinds of
continuations all over the place in Python.
And implementation of 1.) will definately make use of them,
simply since any state of a Python frame at any time is
exactly what the literature calls a Oneshot continuation.
Running programs are trajectories of such continuations.

The difference here is two questions:
a) do we need to give explicit access to continuations as
first class callable object?
b) do we need full continuations (that means snapshots which
can be thrown multiple times).

On 2: Definately no, but nice to have for educational

On 3: Shure.

In general, having continuations as the building blocks for
control srrutures is the most powerful possible way
to play with new concepts.
For implementing 1.), they are overkill, and direct implementations
are more efficient.
But the cost to support full-blown continuations as well
is very small and already implemented, so there is no
reason to leave them at all. They may live in an extra
extension module.
As far as I have read the literature, I have the strong
impression that Python's continuations are the first,
really effective implementation. The reason is that
Python already has a relatively pricy way to represent
its frames, and turning them into continuations is just
In optimized Scheme implementations which have a compiler, true
stack frames and so on, they become quite expensive constructs.

cheers - chris

Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com
Stackless mailing list
Stackless at starship.python.net

More information about the Stackless mailing list