Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrapper': 0.09; 'def': 0.12; 'jan': 0.12; 'language.': 0.14; 'cleaner': 0.16; 'dig': 0.16; 'handler,': 0.16; 'perfect.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'roy': 0.16; 'true:': 0.16; 'language': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'certainly': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'code': 0.31; 'fri,': 0.33; 'but': 0.35; 'var': 0.36; 'yield': 0.36; 'turn': 0.37; 'generic': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'itself': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'break': 0.61; 'kind': 0.63; 'our': 0.64; 'smith': 0.68; 'thoroughly': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Ifs and assignments Date: Fri, 03 Jan 2014 04:29:49 +0000 References: <52C59FF6.5000607@allsup.co> <52c62fa8$0$30001$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-78-147-28-22.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1388723405 news.xs4all.nl 2845 [2001:888:2000:d::a6]:43900 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63032 On 03/01/2014 04:25, Chris Angelico wrote: > On Fri, Jan 3, 2014 at 3:14 PM, Roy Smith wrote: >> Or turn it into a generator: >> That certainly makes your mainline code cleaner... > > Cleaner perhaps, but not clearer. Instead of seeing the original > function (say, a database retrieve-next call), you see a wrapper and > have to go dig to find out what it's actually doing. Unless it's some > kind of generic handler, like: > > def funcinator(func,*args): > while True: > var = func(*args) > if var: > yield var > else: > break > > while funcinator(cur.getnext): > .... > > But even that would be problematic until it got so thoroughly > understood that it's like enumerate() - which is itself still not > perfect. > > ChrisA > I find the above rather funcy :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence