Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57811
| References | <mailman.1693.1382953842.18130.python-list@python.org> <526e4700$0$29972$c3e8da3$5496439d@news.astraweb.com> |
|---|---|
| Date | 2013-10-28 22:18 +1100 |
| Subject | Re: how to avoid checking the same condition repeatedly ? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1695.1382959135.18130.python-list@python.org> (permalink) |
On Mon, Oct 28, 2013 at 10:14 PM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > if needs_preprocessing: > for elem in iterable: > # If you change this block, you must remember to change the > # block below too! > preprocess(item) > do_this(item) > do_that(item) > do_something_else(item, arg1, arg2, expression) > do_another_thing(item + arg3, key=whatever) > print(item) > else: > for elem in iterable: > # If you change this block, you must remember to change the > # block above too! > preprocess(item) > do_this(item) > do_that(item) > do_something_else(item, arg1, arg2, expression) > do_another_thing(item, key=whatever) > print(item) > > > The careful reader will notice that there's already a bug in this. For a start, you're preprocessing in the second block... I don't think that was your intentional bug :) ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how to avoid checking the same condition repeatedly ? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-10-28 09:50 +0000
Re: how to avoid checking the same condition repeatedly ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-28 11:14 +0000
Re: how to avoid checking the same condition repeatedly ? Chris Angelico <rosuav@gmail.com> - 2013-10-28 22:18 +1100
Re: how to avoid checking the same condition repeatedly ? Steven D'Aprano <steve@pearwood.info> - 2013-10-29 04:51 +0000
Re: how to avoid checking the same condition repeatedly ? Piet van Oostrum <piet@vanoostrum.org> - 2013-10-28 14:31 -0400
Re: how to avoid checking the same condition repeatedly ? Nobody <nobody@nowhere.com> - 2013-10-28 19:37 +0000
Re: how to avoid checking the same condition repeatedly ? Neil Cerutti <neilc@norwich.edu> - 2013-10-29 13:44 +0000
Re: how to avoid checking the same condition repeatedly ? rusi <rustompmody@gmail.com> - 2013-10-29 09:13 -0700
Re: how to avoid checking the same condition repeatedly ? Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-28 23:14 -0700
Re: how to avoid checking the same condition repeatedly ? Chris Angelico <rosuav@gmail.com> - 2013-10-29 17:39 +1100
Re: how to avoid checking the same condition repeatedly ? Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-28 23:53 -0700
Re: how to avoid checking the same condition repeatedly ? Chris Angelico <rosuav@gmail.com> - 2013-10-29 18:09 +1100
Re: how to avoid checking the same condition repeatedly ? Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-29 16:55 -0700
Re: how to avoid checking the same condition repeatedly ? alex23 <wuwei23@gmail.com> - 2013-10-30 11:38 +1000
Re: how to avoid checking the same condition repeatedly ? Mariano Anaya <marianoanaya@gmail.com> - 2013-10-30 06:34 -0700
csiph-web