Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!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; 'from:addr:yahoo.co.uk': 0.04; 'subject:code': 0.07; '22,': 0.09; '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; 'language.': 0.14; 'question.': 0.14; '"is': 0.16; 'a()': 0.16; 'b()': 0.16; 'cleaner': 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; 'certainly': 0.24; 'possibly': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'code': 0.31; 'bunch': 0.31; 'december': 0.35; 'johnson': 0.35; 'requirement': 0.35; 'there': 0.35; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'our': 0.64; 'more': 0.64; 'beat': 0.68; 'otten': 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: Mon, 23 Dec 2013 12:44:20 +0000 References: <420afeb9-674f-4974-8f6d-6cc80c7f57b1@googlegroups.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-20-57.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <420afeb9-674f-4974-8f6d-6cc80c7f57b1@googlegroups.com> 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: 1387802656 news.xs4all.nl 2861 [2001:888:2000:d::a6]:54993 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62621 On 22/12/2013 23:57, Rick Johnson wrote: > On Sunday, December 22, 2013 5:02:51 PM UTC-6, Mark Lawrence wrote: >> On 22/12/2013 22:51, Chris Angelico wrote: > >> if a() == 0: >> >> if b() == 0: >> >> c() >> >> I can only see one way that you can possibly intepret it. > [snip molehill turned into Himalayas] Again Frank's original question. " 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() " What is so difficult to understand about "is there a cleaner or more pythonic way to do this other than the following?" Peter Otten for one certainly managed to get it, and as always managed to beat me to the draw :( -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence