Fake threads (was [Python-Dev] ActiveState & fork & Perl)

Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Tue, 13 Jul 1999 12:54:00 +0100 (NFT)

After a short vacation, I'm trying to swallow the latest discussion
about control flow management & derivatives. Could someone help me
please by answering two naive questions that popped up spontaneously
in my head:

Tim Peters wrote:

[a biased short course on generators, continuations, coroutines]
> ...
> Generators add two new abstract operations, "suspend" and "resume".  When a
> generator suspends, it's exactly like a return today except we simply
> decline to decref the frame.  That's it!  The locals, and where we are in
> the computation, aren't thrown away.  A "resume" then consists of
> *re*starting the frame at its next bytecode instruction, with the retained
> frame's locals and eval stack just as they were.
> ...
> too-simple-to-be-obvious?-ly y'rs  - tim

Yes. I'm trying to understand the following:

1. What does a generator generate?

2. Clearly, what's the difference between a generator and a thread?

       Vladimir MARANGOZOV          | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252