Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'statements': 0.09; 'python': 0.11; '(note:': 0.16; 'boolean': 0.16; 'comparisons,': 0.16; 'conditional': 0.16; 'expands': 0.16; 'kris': 0.16; 'message- id:@4ax.com': 0.16; 'precedence': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'shortcut': 0.16; 'subject:3.3': 0.16; 'all,': 0.19; 'thu,': 0.19; 'seems': 0.21; '(the': 0.22; 'aug': 0.22; 'separate': 0.22; 'url:home': 0.24; 'equivalent': 0.26; 'header:X-Complaints-To:1': 0.27; 'code': 0.31; 'bunch': 0.31; 'this.': 0.32; 'subject:with': 0.35; 'something': 0.35; 'but': 0.35; 'doing': 0.36; 'charset:us-ascii': 0.36; 'thank': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'easy': 0.60; 'first': 0.61; 'of:': 0.68; 'statement,': 0.68; 'actually,': 0.84; 'awhile': 0.84; 'received:108': 0.93; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Issues with if and elif statements in 3.3 Date: Thu, 08 Aug 2013 19:37:12 -0400 Organization: IISS Elusive Unicorn References: <02128546-7a5d-4fe8-a472-47cfd4f76342@googlegroups.com> <5674a7c0-d046-43a5-a998-29ada6c08412@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-79-216-177.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1376005040 news.xs4all.nl 15871 [2001:888:2000:d::a6]:44739 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:52235 On Thu, 8 Aug 2013 15:20:01 -0700 (PDT), Kris Mesenbrink 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/