Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52235
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: Issues with if and elif statements in 3.3 |
| Date | 2013-08-08 19:37 -0400 |
| Organization | IISS Elusive Unicorn |
| References | <02128546-7a5d-4fe8-a472-47cfd4f76342@googlegroups.com> <mailman.346.1375958120.1251.python-list@python.org> <5674a7c0-d046-43a5-a998-29ada6c08412@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.379.1376005040.1251.python-list@python.org> (permalink) |
On Thu, 8 Aug 2013 15:20:01 -0700 (PDT), Kris Mesenbrink
<krismesenbrink@gmail.com> declaimed the following:
>WOW as if it was something as easy as that,i had been looking for awhile on what i was doing wrong. as it seems i just don't know my way around if statements at all, thank a bunch for this. makes everything else i have been code work
Actually, it is /not/ the if you misunderstood -- but the precedence of
Boolean algebra (the conditional can be lifted out of the if and put on a
separate line):
cond = something == x or y or z
if cond:
The flaw would be in the first statement, not the IF.
Python does support shortcut form of:
cond = value <= x <= other
(note: you can use other comparisons, but know what you are doing)
That expands to the equivalent of
cond = value <= x and x <= other
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Issues with if and elif statements in 3.3 krismesenbrink@gmail.com - 2013-08-08 00:19 -0700
Re: Issues with if and elif statements in 3.3 Dave Angel <davea@davea.name> - 2013-08-08 10:34 +0000
Re: Issues with if and elif statements in 3.3 Kris Mesenbrink <krismesenbrink@gmail.com> - 2013-08-08 15:20 -0700
Re: Issues with if and elif statements in 3.3 Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-08-08 19:37 -0400
Re: Issues with if and elif statements in 3.3 Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-08-08 19:31 -0400
csiph-web