Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.05; 'python': 0.09; 'modulo': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'evaluation;': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'integer': 0.17; '>>>': 0.18; 'feb': 0.19; '"",': 0.22; 'needed.': 0.23; '(most': 0.27; 'header:X-Complaints-To:1': 0.28; 'division': 0.29; 'multiline': 0.29; 'stuff': 0.30; 'file': 0.32; 'print': 0.32; 'traceback': 0.33; 'url:home': 0.33; 'zero': 0.33; 'to:addr :python-list': 0.33; 'fail': 0.35; 'received:org': 0.36; 'except': 0.36; 'charset:us-ascii': 0.36; 'does': 0.37; 'skip:z 10': 0.37; 'subject:: ': 0.38; 'skip:l 20': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; '2013': 0.84; 'conditions,': 0.84; 'dennis': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Python Newbie Date: Sun, 24 Feb 2013 21:08:43 -0500 Organization: > Bestiaria Support Staff < References: <5127848B.1060004@gmail.com> <928d2cf7-728b-4f35-b8c9-4c9b958507e5@googlegroups.com> <61471a01-ee6e-4bc6-bd08-8696a31ec1eb@googlegroups.com> <512A796D.6070802@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-253-96-177.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361758130 news.xs4all.nl 6842 [2001:888:2000:d::a6]:53874 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:39861 On Sun, 24 Feb 2013 21:58:36 +0000, Joshua Landau declaimed the following in gmane.comp.python.general: > > condition1 = long_condition_expression_1 > condition2 = long_condition_expression_2 > condition3 = long_condition_expression_3 > > if condition1 and condition2 and condition3: > STUFF > > No multiline needed. If you have *many* conditions, then: > Except that Python does short-circuit evaluation; your scheme will fail in some situations: >>> x = 0 >>> if x != 0 and 32 / x > 4: ... print "we passed" ... >>> c1 = x != 0 >>> c2 = 32 / x > 4 Traceback (most recent call last): File "", line 1, in ZeroDivisionError: integer division or modulo by zero >>> -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/