creating generators from function

Simon Wittber simonwittber at
Wed Dec 8 15:18:27 CET 2004

> I'm a little confused as to what you're trying to do here.  The f()
> function, in particular, doesn't make much sense

I see I am misunderstood. The example was contrived, and it seems, incorrect.

I simulate threads, using generator functions and a scheduler.

My implementation lives here:

If the same functions were to run inside a normal thread, they would
need to loop forever, rather than yield None on each iteration. I see
now that replacing return with yield won't work, a yield instruction
needs to be inserted somewhere.

I guess this changes my question to: Can I convert a function
containing an infinite loop, into a generator which will yield on each


More information about the Python-list mailing list