Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:search': 0.07; 'though.': 0.07; 'pm,': 0.10; 'this:': 0.10; 'wrote:': 0.14; 'did.': 0.16; 'iterator': 0.16; 'logic.': 0.16; 'cc:addr:python- list': 0.17; 'tue,': 0.17; 'cheers,': 0.19; 'header:In-Reply- To:1': 0.21; 'cc:2**0': 0.22; 'trying': 0.23; 'received:209.85.161.46': 0.23; 'received:mail- fx0-f46.google.com': 0.23; 'received:209.85.161': 0.26; 'suggestion': 0.26; "i'm": 0.27; 'message-id:@mail.gmail.com': 0.28; 'class': 0.29; 'instead': 0.29; 'cc:addr:python.org': 0.30; 'second': 0.30; 'logic': 0.30; 'actually': 0.33; "i'll": 0.34; 'regular': 0.34; 'chris': 0.34; '17,': 0.35; 'using': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.37; 'push': 0.37; 'think': 0.38; 'hoping': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'received:209': 0.39; 'kind': 0.60; 'forget': 0.61; 'glad': 0.66; 'provider,': 0.67; '11:27': 0.84; 'birds': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=JWoyNLHOViknpeOXtbyTkoN45P/qP2otODPIjobZpug=; b=dhgS7VcMlQck0GWFWZBLYPszOVhdfllui/RuChXqcPlHm2LVH5iGulN7i40tAK040y 2c6ETMwFgWdgVsvLtXhR9rrCF5xtVr9wj4bHfaWyxege7mAs/I1wISFu69yC0Ha1M5jH cSASykYNLWTYxfFhDF1S47bE9g44foMd3xqog= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=qKSKNokZW+aJ4ZBRTxwE30BfRg6GL9euYphSHdjyOZDlvAFfGJwyt+k20hbMrQ7kCK CVqrS1GuQdJ1sfadtnqzLIXB6rMSPR3TAD6yd+LbKWi9+2AothaQbG4t//mhtbsMfnxY /sUoDURqCnHkjcKJTyrx3QCI/5kZB/+Lt6oAs= MIME-Version: 1.0 In-Reply-To: <4DD358B3.2060308@simplistix.co.uk> References: <4DD2AA99.3010508@simplistix.co.uk> <4DD358B3.2060308@simplistix.co.uk> From: Ian Kelly Date: Tue, 17 May 2011 23:46:27 -0600 Subject: Re: in search of graceful co-routines To: Chris Withers Content-Type: text/plain; charset=ISO-8859-1 Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305697618 news.xs4all.nl 49042 [::ffff:82.94.164.166]:45362 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5654 On Tue, May 17, 2011 at 11:27 PM, Chris Withers 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