Generators versus Coroutines

Nick Patavalis npat at efault.net
Mon Aug 16 14:59:53 EDT 2004


On 2004-08-16, Bernhard Mulder <bwm at acm.org> wrote:
> If you want, you can yield across multiple levels by converting 
> functions into generators and calls into for loops.
>

Or while loops, if you don't know a-priori how many times you have to
call the generator. Yes this is possible, but unmaintainable (makes
the code impossibly tangled) to the point of been useless. The problem
with this specific approach if of-course that Python has no macros, so
you can't hide it somehow; it has to be repeated in the code *every*
*time*; this makes makes the code impossible to read.

/npat





More information about the Python-list mailing list