Stackless Python 0.3

Christian Tismer
Tue, 13 Jul 99 15:39:13 GMT


               Stackless Python 0.3
           A Python Implementation Which
             Does Not Use The C Stack

What is it?
A plugin-replacement for core Python.
It should run any program which runs under Python 1.5.2 .
But it does not need space on the C stack.

Why did I write it?
Stackless Python was never written before (afaik), since it
was said to be impossible without major rewrites of core Python.
I am proving the controverse:
It is easy to write, just hard to think.

Recent changes:
Version 0.3 has been written while developing a continuation
module which is about to ship. A couple of enhancements and
changes were necessary to make continuations fly. Some drastic
changes to frame management have been made. Stackless Python
is now also able to keep track of recursive interpreter
incarnations and to detect/resolve possible collisions
between their frames. As a proof of concept, continuationsmodule.c
will ship in a few days.

Who needs it?
At the moment, this is only useful for C programmers
who want to try certain new ideas. Hardcore stuff.
It allows to modify the current execution state by
changing the frame stack chain without restictions,
and it allows for pluggable interpreters on a per-frame-basis.

The possibilities are for instance:

Continuations, with which we will build Coroutines and Generators

Restartable exceptions and Persistent execution state
are the next topic to think about. They are possible.

Stackless extension modules can be built. The new builtin
stackless "map" function is a small example for this.

Coroutines are able to run at the speed of
a single C function call, which makes them a considerable
alternative in certain algorithms.
This is no longer a speculation since I have working
coroutine prototypes, written with continuations.

Status of the project:
Stackless-ness has been implemented and tested with pystone.
pystone works correctly and is about 10 % slower than
with standard Python.

What I need at the moment is
- time to do the right design of coroutines on top of continuations
- your input, your testing, critics and hints.

Some still rough documentation is available at

Source code and a VC++6.0 build for Windows can be found
from the document or directly from

cheers - chris

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

<P><A HREF="">Stackless Python
0.3</A> - a version of Python 1.5.2 that does not need space on the C
stack.  (12-Jul-99)

----------- comp.lang.python.announce (moderated) ----------
Article Submission Address:
Python Language Home Page:
Python Quick Help Index: