Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79052
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Rob Gaddi <rgaddi@technologyhighland.invalid> |
| Newsgroups | comp.lang.python |
| Subject | Re: while loop - multiple condition |
| Date | Mon, 13 Oct 2014 09:12:48 -0700 |
| Organization | Highland Technology, Inc. |
| Lines | 18 |
| Message-ID | <20141013091248.1ffd94a0@rg.highlandtechnology.com> (permalink) |
| References | <loom.20141012T190458-947@post.gmane.org> <CAPTjJmrPgTdysCnLcbMqYFiGGwg-wV_mjfw16Kt15_zuv_624g@mail.gmail.com> <loom.20141012T191849-946@post.gmane.org> <CAPTjJmouQsm_9ccqdtmJ3kmd4SqmmOqk3OVdS4mngeHaVT2S6w@mail.gmail.com> <loom.20141012T195709-937@post.gmane.org> <mailman.14798.1413137019.18130.python-list@python.org> <878uklcd3r.fsf@elektro.pacujo.net> <mailman.14805.1413146405.18130.python-list@python.org> <543b0706$0$13005$c3e8da3$5496439d@news.astraweb.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | mx02.eternal-september.org; posting-host="e1074427d63fe1fd927d8970bf85e44c"; logging-data="31525"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OxInKzG+5vKHyRAGNHail" |
| X-Newsreader | Claws Mail 3.9.3 (GTK+ 2.24.23; x86_64-pc-linux-gnu) |
| Cancel-Lock | sha1:7Od0dKSueMN372h/ZLLn0CfL5ak= |
| Xref | csiph.com comp.lang.python:79052 |
Show key headers only | View raw
On Mon, 13 Oct 2014 09:56:02 +1100 Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > > When you have multiple clauses in the condition, it's easier to reason about > them if you write the clauses as positive statements rather than negative > statements, that is, "something is true" rather than "something is not > true", and then use `not` to reverse it if you want to loop *until* the > overall condition is true. > I was just explaining this concept to a young pup the other day. De Morgan's lets you say that (not (p and q)) == ((not p) or (not q)), but the positive logic flavor is substantially less error-prone. People are fundamentally not as good at thinking about inverted logic. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: while loop - multiple condition Chris Angelico <rosuav@gmail.com> - 2014-10-13 05:03 +1100
Re: while loop - multiple condition Marko Rauhamaa <marko@pacujo.net> - 2014-10-12 22:16 +0300
Re: while loop - multiple condition Chris Angelico <rosuav@gmail.com> - 2014-10-13 06:22 +1100
Re: while loop - multiple condition Tim Chase <python.list@tim.thechases.com> - 2014-10-12 15:42 -0500
Re: while loop - multiple condition Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-13 09:56 +1100
Re: while loop - multiple condition Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-10-13 09:12 -0700
Re: while loop - multiple condition Rustom Mody <rustompmody@gmail.com> - 2014-10-13 09:26 -0700
Re: while loop - multiple condition Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-10-13 09:43 -0700
Re: while loop - multiple condition Rustom Mody <rustompmody@gmail.com> - 2014-10-13 10:12 -0700
Re: while loop - multiple condition Michael Torrie <torriem@gmail.com> - 2014-10-13 16:08 -0600
Re: while loop - multiple condition wxjmfauth@gmail.com - 2014-10-13 23:34 -0700
Re: while loop - multiple condition giacomo boffi <pecore@pascolo.net> - 2014-10-15 01:04 +0200
Re: while loop - multiple condition Chris Angelico <rosuav@gmail.com> - 2014-10-15 10:16 +1100
csiph-web