in search of graceful co-routines

Chris Angelico rosuav at gmail.com
Tue May 17 22:50:09 EDT 2011


On Wed, May 18, 2011 at 3:04 AM, Chris Withers <chris at simplistix.co.uk> wrote:
> Hi All,
>
> I'm looking for a graceful pattern for the situation where I have a provider
> of a sequence, the consumer of a sequence and code to moderate the two, and
> where I'd like to consumer to be able to signal to the provider that it
> hasn't succeeded in processing one element in the queue.

I wonder would this work nicely if concepted as a couple of threads
with a Queue between them? Whether or not you actually use threads per
se, or if you just have two separate processing loops and message
passing between them, it might be easier to code that way than as
generators.

Chris Angelico



More information about the Python-list mailing list