Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'subject:code': 0.07; 'executed': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'run,': 0.09; 'language.': 0.14; '23,': 0.16; 'a()': 0.16; 'b()': 0.16; 'cleaner': 0.16; 'cui': 0.16; 'pythonic': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:python': 0.16; 'followed': 0.16; 'language': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'header:User-Agent:1': 0.23; 'mon,': 0.24; 'handling': 0.26; 'possibly': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'testing': 0.29; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'dec': 0.30; 'originally': 0.30; 'code': 0.31; 'bunch': 0.31; 'device': 0.34; 'sense': 0.34; 'advice': 0.35; 'requirement': 0.35; 'there': 0.35; 'really': 0.36; 'doing': 0.36; 'thanks': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'previous': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'mentioned': 0.61; 'took': 0.61; 'matter': 0.61; 'you.': 0.62; 'our': 0.64; 'more': 0.64; 'reply': 0.66; 'frank': 0.68; 'home': 0.69; 'stated': 0.69; 'clearer': 0.84; 'rick': 0.93; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: cascading python executions only if return code is 0 Date: Sun, 22 Dec 2013 23:02:51 +0000 References: 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-146-15-252.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: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387753377 news.xs4all.nl 2968 [2001:888:2000:d::a6]:43448 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62561 On 22/12/2013 22:51, Chris Angelico wrote: > On Mon, Dec 23, 2013 at 9:14 AM, Frank Cui wrote: >> Thanks for pointing out. I accept your advice and will try to make the >> questions clearer and more straightforward to interpretate . I already took >> the suggestion of using exception-based handling over the return code. >> >> As to testing whether the previous function fails or succeeds, this doesn't >> really matter in the sense that I already mentioned a return code of 0. > > Ranting Rick is one of the list's resident trolls. Don't take it amiss > that he turned his flamethrowers on you. :) > > ChrisA > Given that Frank originally stated this " I have a requirement where I need to sequentially execute a bunch of executions, each execution has a return code. the followed executions should only be executed if the return code is 0. is there a cleaner or more pythonic way to do this other than the following ? if a() == 0: if b() == 0: c() " I can only see one way that you can possibly intepret it. Perhaps rr was dashing off a reply on a mobile device while doing a home run, hence wasn't concentrating on what Frank had actually said? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence