Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57915
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Neil Cerutti <neilc@norwich.edu> |
| Newsgroups | comp.lang.python |
| Subject | Re: how to avoid checking the same condition repeatedly ? |
| Date | 29 Oct 2013 13:44:51 GMT |
| Organization | Norwich University |
| Lines | 17 |
| Message-ID | <bd9sejFe0h3U1@mid.individual.net> (permalink) |
| References | <mailman.1693.1382953842.18130.python-list@python.org> <pan.2013.10.28.19.37.42.192000@nowhere.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net Zf5GfB6M6/MlxVTOlwJuYwroyvB43VGmO54xCf7PS6SyG3Ibtw |
| Cancel-Lock | sha1:U0/oFdnA7YScXnlTjyaJvK6cdqI= |
| User-Agent | slrn/0.9.9p1/mm/ao (Win32) |
| Xref | csiph.com comp.lang.python:57915 |
Show key headers only | View raw
On 2013-10-28, Nobody <nobody@nowhere.com> wrote: > On Mon, 28 Oct 2013 09:50:19 +0000, Wolfgang Maier wrote: >> So my question is: is there an agreed-upon generally best way >> of dealing with this? > > Yes. Just leave the test inside the loop. > > If you're sufficiently concerned about performance that you're > willing to trade clarity for it, you shouldn't be using Python > in the first place. When you detect a code small, as Wolfgang did, e.g., "I'm repeating the same exact test condition in several places," you should not simply ignore it, even in Python. -- Neil Cerutti
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