a simple example of Stackless Python

Courageous jkraska1 at san.rr.com
Mon Oct 30 22:52:57 EST 2000


> If my understanding is right, what cotinuation objects save is not the
> whole context including variables but only the point of execution.
> Am I right on this?

A continuation saves the entire local context to the degree that
it matters. Continuations are really much easier to understand
the moment you realize that you've been using them already, more
or less:

When an ordinary function returns to its calling point, it is returning
to the one "continuation" it understands. Note that this analogy is
quite apropos, in that, while your execution context might be saved
and restored, all of those things which are altered globally as a
consequence of the flow of the program remain altered. The same is
true of Stackless Python's user-usable continuations.

"first class" continuations, as those in Stackless Python, give
programmers a direct handle to the ability to both generate and
use these contexts in some more meaningful way. IIRC, they were
originally invented largely to allow programmers to experiment
with alternate flow-control techniques, and are still used in
Scheme for that purpose.






C//



More information about the Python-list mailing list