Generators versus Coroutines

Paul Rubin http
Sat Aug 14 19:57:12 EDT 2004


Michael Sparks <zathras at thwackety.com> writes:
> > It seems to me that in python, generators are not truly coroutines.
> 
> Assuming you mean there isn't available a default scheduler for them, or
> there isn't pre-emption built-in I agree. If you mean something else, I'm
> curious as to what you think is missing. (I've also been using generators
> as co-routines for sometime for various reasons)

You can't yield across multiple levels of function calls.  That's why
they're called "simple generators" instead of just "generators".



More information about the Python-list mailing list