[Python-Dev] Stackless Python - Pros and Cons

Eric S. Raymond esr@thyrsus.com
Sun, 6 Aug 2000 18:51:59 -0400


Tim Peters <tim_one@email.msn.com>:
> [ Eric S. Raymond]
> > ...
> > I want this feature [generators] a lot.  Guido has agreed in principle
> > that we ought to have generators, but there is not yet a well-defined
> > path forward to them.  Stackless may be the most promising route.
> 
> Actually, if we had a PEP <wink>, it would have recorded for all time that
> Guido gave a detailed description of how to implement generators with minor
> changes to the current code.  It would also record that Steven Majewski had
> already done so some 5 or 6 years ago. 

Christian Tismer, over to you.  I am not going to presume to initiate
the continuations PEP when there's someone with a Python
implementation and extensive usage experience on the list.  However, I
will help with editing and critiques based on my experience with other
languages that have similar features, if you want.

>                                     IMO, the real reason we don't have
> generators already is that they keep getting hijacked by continuations
> (indeed, Steven gave up on his patches as soon as he realized he couldn't
> extend his approach to continuations).

This report of repeated "hijacking" doesn't surprise me a bit.  In fact,
if I'd thought about it I'd have *expected* it.  We know from experience
with other languages (notably Scheme) that call-with-current-continuation
is the simplest orthogonal primitive that this whole cluster of concepts can
be based on.  Implementors with good design taste are going to keep finding
their way back to it, and they're going to feel incompleteness and pressure
if they can't get there.

This is why I'm holding out for continuation objects and 
call-with-continuation to be an explicit Python builtin. We're going to get
there anyway; best to do it cleanly right away.
-- 
		<a href="http://www.tuxedo.org/~esr">Eric S. Raymond</a>

"Taking my gun away because I might shoot someone is like cutting my tongue
out because I might yell `Fire!' in a crowded theater."
        -- Peter Venetoklis