PEP 255: Simple Generators

Greg Copeland gtcopeland at earthlink.net
Mon Jun 25 03:44:42 EDT 2001


"Tim Peters" <tim.one at home.com> 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...

Greg



More information about the Python-list mailing list