ANN: Stackless Python 0.2

Christian Tismer tismer at appliedbiometrics.com
Mon Jun 28 13:09:09 CEST 1999


Corran Webster wrote:
> 
> In article <37628EAA.C682F16C at appliedbiometrics.com>,
> Christian Tismer  <tismer at appliedbiometrics.com> wrote:
> >ANNOUNCING:
> >
> >               Stackless Python 0.2
> >           A Python Implementation Which
> >             Does Not Ese 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.
> [snip]
> 
> I managed to get this to build eventually (thanks to the hints from Michael
> Hudson).  Looking at it, I wonder whether there's the potential here for
> more than coroutines and to write an implementation of threading within
> Python.  Each thread would presumably need its own Python stack, and a
> queueing and locking system would need to be added somehow, but because
> the Python and C stacks are no longer intertangled, switching between
> threads should be easy (as opposed to impossible <wink>).

Please be a little patient. :-)

Yesterday I finished an alpha version
of first class continuations in Python. This allows you to do
everything, and your threads are on my todo-list from the first
time.

> This wouldn't be quite as flexible as the current implimentations of
> threads at the C level - C extensions would be called in a single block
> with no way to swap threads until they return.  On the other hand, this
> would allow every platform to have some sort of threading available,
> which would be a boon.

Not really. C extensions can be written in a stackless
manner. Whenever they need to call into the interpreter,
they can do it in a conformant manner. They do so by just
using their own frame with their own executor.
You need to change your thinking here: There is no return
in that sense any longer. We just have frames in some chains,
and all local state is kept in frames.

> Unfortunately I'm not familiar enough with threads to go out there and
> implement it right away, but I thought I'd at least raise it as a
> possibility and see what people think and what the pros and cons are.

It will be available soon, and it will be nothing more than
a Python module which tames continuations to behave as threads.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at 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




More information about the Python-list mailing list