Generators versus Coroutines

Tim Peters tim.peters at gmail.com
Tue Aug 17 12:34:55 EDT 2004


[Lenard Lindstrom]
> I do not consider using threads to implement coroutines a practical
> solution.

It depends on the app, but in general I agree.

> It was alluded to in a posting by Tim Peters giving his take on generators,
> coroutines and continuations. The case he mentioned was more than
> likely a demonstration or example than an actual production module.

Demo/threads/ in a Python source distribution contains thread-based
implementations of coroutines and generators.  They were certainly
just demos, and PEP 255 even mentions the latter as a concrete example
of why threads aren't a practical implementation technique for
generators.



More information about the Python-list mailing list