Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62545 > unrolled thread
| Started by | Frank Cui <ycui@outlook.com> |
|---|---|
| First post | 2013-12-22 15:59 -0300 |
| Last post | 2013-12-22 15:59 -0300 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
RE: cascading python executions only if return code is 0 Frank Cui <ycui@outlook.com> - 2013-12-22 15:59 -0300
| From | Frank Cui <ycui@outlook.com> |
|---|---|
| Date | 2013-12-22 15:59 -0300 |
| Subject | RE: cascading python executions only if return code is 0 |
| Message-ID | <mailman.4503.1387740660.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
Thanks, this looks beautiful > To: python-list@python.org > From: __peter__@web.de > Subject: Re: cascading python executions only if return code is 0 > Date: Sun, 22 Dec 2013 20:26:15 +0100 > > Frank Cui wrote: > > > hey guys, > > 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() > > Thanks for your input. > > frank > > funcs = a, b, c > > # option 1 > for f in funcs: > if f(): > break > > # option 2 > any(f() for f in funcs) > > > -- > https://mail.python.org/mailman/listinfo/python-list
Back to top | Article view | comp.lang.python
csiph-web