Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.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.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:code': 0.07; 'executed': 0.09; 'a()': 0.16; 'b()': 0.16; 'cleaner': 0.16; 'guys,': 0.16; 'pythonic': 0.16; 'subject:python': 0.16; 'followed': 0.16; 'code.': 0.18; 'hey': 0.18; 'to:name:python- list@python.org': 0.22; 'code': 0.31; 'bunch': 0.31; 'requirement': 0.35; 'there': 0.35; 'thanks': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'received:65.54': 0.38; 'received:65.54.190': 0.38; 'received:bay0.hotmail.com': 0.38; 'to:addr:python.org': 0.39; 'more': 0.64; 'frank': 0.68 X-TMN: [Gc9O9m50d5hXxeUNht3H2uNrVw9AZeg/] X-Originating-Email: [ycui@outlook.com] Content-Type: multipart/alternative; boundary="_015bf8f7-97e4-433e-a95b-c4b1485d7704_" From: Frank Cui To: "python-list@python.org" Subject: cascading python executions only if return code is 0 Date: Sun, 22 Dec 2013 15:37:04 -0300 Importance: Normal MIME-Version: 1.0 X-OriginalArrivalTime: 22 Dec 2013 19:07:05.0168 (UTC) FILETIME=[00D07500:01CEFF49] 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: 42 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387739297 news.xs4all.nl 2909 [2001:888:2000:d::a6]:46103 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62541 --_015bf8f7-97e4-433e-a95b-c4b1485d7704_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable hey guys=2C I have a requirement where I need to sequentially execute a bunch of execut= ions=2C each execution has a return code. the followed executions should on= ly be executed if the return code is 0. is there a cleaner or more pythonic= way to do this other than the following ?=20 if a() =3D=3D 0: if b() =3D=3D 0: c() Thanks for your input. frank = --_015bf8f7-97e4-433e-a95b-c4b1485d7704_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
hey guys=2C

I= have a requirement where I need to sequentially execute a bunch of executi= ons=2C each execution has a return code. the followed executions should onl= y be executed if the return code is 0. is there a cleaner or more pythonic = way to do this other than the following ? =3B

= if a() =3D=3D 0:
 =3B  =3B if b() =3D=3D 0:
&nb= sp=3B  =3B  =3B  =3B c()

Thanks for yo= ur input.

frank
= --_015bf8f7-97e4-433e-a95b-c4b1485d7704_--