PEP 255: Simple Generators

Greg Copeland gtcopeland at
Mon Jun 25 09:44:42 CEST 2001

"Tim Peters" < at> writes:

> Also none:  a generator can yield only to its immediate caller.  In that
> sense it's no more powerful (or difficult to implement) than call/return.
> It can't "remember the state of the call stack", a generator can only
> remember its own local state, and it can't yield to any places other than
> the places from which it's explicitly called.  That's what spares generators
> from the implementation headaches of full-blown continuations.
> think-of-'em-as-resumable-functions-ly y'rs  - tim

So what happens when you have two threads calling a generator.  I guess they
are distinct...


More information about the Python-list mailing list