Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'diff': 0.05; 'line:': 0.07; 'trailing': 0.07; 'cc:addr:python-list': 0.10; ':-)': 0.13; '(usually)': 0.16; '-tkc': 0.16; 'alphabetical': 0.16; 'bouncing': 0.16; 'comma,': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message-id:@tim.thechases.com': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'wrote:': 0.17; 'skip:u 30': 0.17; 'tend': 0.17; 'either.': 0.22; 'cc:2**0': 0.23; 'changes,': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; "doesn't": 0.28; '>>>>': 0.29; 'usually': 0.30; 'towards': 0.32; 'cases,': 0.33; 'too.': 0.35; 'something': 0.35; 'but': 0.36; 'closing': 0.36; 'skip:m 40': 0.36; 'should': 0.36; 'too': 0.36; 'being': 0.37; 'item': 0.37; 'quite': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'skip:l 20': 0.38; 'little': 0.39; 'where': 0.40; 'subject:-': 0.40; 'easy': 0.60; 'letters': 0.62; 'email addr:gmail.com': 0.63; 'making': 0.64; 'matter.': 0.65; 'special': 0.73; 'lean': 0.84; 'paren': 0.84; 'received:50.22': 0.84; 'noise': 0.91 Date: Thu, 18 Oct 2012 06:05:34 -0500 From: Tim Chase User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 MIME-Version: 1.0 To: wxjmfauth@gmail.com Subject: Re: A desperate lunge for on-topic-ness References: <507fa256$0$11093$c3e8da3@news.astraweb.com> <507fc6b4$0$6861$e4fe514c@news2.news.xs4all.nl> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Source: X-Source-Args: X-Source-Dir: Cc: python-list@python.org 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: 62 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1350558280 news.xs4all.nl 6842 [2001:888:2000:d::a6]:49590 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31627 On 10/18/12 04:33, wxjmfauth@gmail.com wrote: > I use a "double indentation". > >>>> if 'asdf' and 'asdf' and 'asdf' \ > ... 'asdf' and 'asdf' and \ > ... 'asdf' and 'asdf': > ... print('do if') > ... s = 'asdf' > ... ss = 'asdf' > ... > do if >>>> if looks_like_it_might_be_spam( > ... some_longer_variables, > ... here_and_here, and_here_also): > ... logger.notice("might be spam") > ... move_to_spam_folder(some_longer_variables) > ... update_spam_statistics(here_and_here) I lean towards double-indent as well, though I favor parens/brackets vs. trailing backslashes. My conditions usually go one-per-line, too. I also tend to put my closing paren+colon on a stand-alone line: if ( something or something_else or yet_other_stuff ): do_thing1() do_thing2() It's not quite as nice with pure parens, working better with function-calls. However, it makes my git/svn diffs easier to read when conditions get added/removed because only that line (usually) changes, rather than having the noise of the paren moving around. In 2.5 and later, I like to write that as if any([ something, something_else, yet_other_stuff, ]): do_thing1() do_thing2() where each item is uniform (one trailing comma, rather than one item being special without a comma/or/and) so I don't have the diff noise for "or"/"and" bouncing around either. Making my diffs easy to read is pretty important to me. -tkc PS: and in such cases, yes, I often alphabetize my conditions too as long as the order doesn't matter. Just a little CDO. That's OCD, but in alphabetical order the way the letters should be :-)