in search of graceful co-routines

Ian Kelly ian.g.kelly at gmail.com
Wed May 18 01:46:27 EDT 2011


On Tue, May 17, 2011 at 11:27 PM, Chris Withers <chris at simplistix.co.uk> wrote:
> Yes, but it's this kind of birds nest I'm trying to avoid...

I was actually kind of hoping you might see it that way.  That's about
as simple as you're going to get using a generator for this, though.
I'll second Terry's suggestion on this:  forget using a generator for
the provider, and instead create an iterator class with regular
methods to decouple the push logic from the pull logic.  I think
you'll be glad that you did.

Cheers,
Ian



More information about the Python-list mailing list