Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: Continuing indentation Date: Thu, 03 Mar 2016 11:30:04 +1100 Lines: 45 Message-ID: References: <0b33c10d-4366-49c7-8416-4d4ecd56ac8b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de Yh0ch2W98dgwqFodOueeugYVq3tFcs183zb8sXLQOUXw== Cancel-Lock: sha1:UTs0GjZEzyfoMOIAl0qJSDWdXi0= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.114 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.79; '*S*': 0.02; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'stake': 0.16; 'assign': 0.22; 'header :User-Agent:1': 0.26; "doesn't": 0.26; 'header:X-Complaints-To:1': 0.26; 'sense': 0.26; 'sentence': 0.29; 'e.g.': 0.30; 'good.': 0.32; 'too': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'to:addr:python.org': 0.40; 'field': 0.60; 'your': 0.60; 'email addr:gmail.com': 0.62; 'you.': 0.64; 'receive': 0.71; '_o__)': 0.84; 'catholic': 0.84; 'coherent': 0.84; 'complex,': 0.84; 'or:': 0.84; 'received:125': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103920 (Igor, your “From” field doesn't contain a name for you. Can you put your name, e.g. “Igor Whateverisyoursurname”, in the “From” field?) codewizard@gmail.com writes: > How about: > > continue_playing = ( > some_condition and > some_other_condition and > some_final_condition > ) > > if continue_playing: > play_bingo() > > or: > > play_conditions = [ > some_condition, > some_other_condition, > some_final_condition, > ] > > if all(play_conditions): > play_bingo() Yes, these are good. When a condition is too complex, it makes sense to assign a name to it. It can even help to pull out a coherent part of the complex condition and assign a name to that:: play_conditions = [ some_other_condition, some_extra_condition, (some and compound and condition)] if some_condition and all(play_conditions): play_bingo() -- \ “Perchance you who pronounce my sentence are in greater fear | `\ than I who receive it.” —Giordano Bruno, burned at the stake by | _o__) the Catholic church for the heresy of heliocentrism, 1600-02-16 | Ben Finney