Stackless Python and Python 2.x

Paul Rubin phr-n2001 at nightsong.com
Mon Sep 3 02:43:54 EDT 2001


"Tim Peters" <tim.one at home.com> writes:
> > The standard doesn't require that you be allowed to jump up the stack.
> 
> It doesn't matter.  Paul asked how generators can be implemented short of
> full-blown coroutines or continuations.  The text I pointed him to showed
> one way it can be done using a single stack.  If he's willing to accept
> continuations as an implementation technique, the ways in which the
> referenced technique run afoul of standard C are trivial by comparison.  C
> isn't the point here; "single stack" is.

Unfortunately your post didn't make it here yet (I hope it gets here
but otherwise I'll try Googling for it).  However, it sounds like you
may have posted some setjmp/longjmp scheme for switching contexts on
one stack.  This is an ancient and honorable C implementation hack,
portable or not.  But it amounts to a method of implementing
coroutines in C.  So you're back to the same question.  If your
generator implementation requires coroutines anyway, why not put
coroutines in the language?



More information about the Python-list mailing list