Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'programmer': 0.03; 'continuation': 0.07; 'subject:PEP': 0.07; 'lines.': 0.09; 'name?': 0.09; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'changes': 0.15; 'finney': 0.16; 'hurts': 0.16; 'perceived': 0.16; 'proc': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'roy': 0.16; 'statement.': 0.16; 'tying': 0.16; 'header:User-Agent:1': 0.23; "i've": 0.25; 'subject: : ': 0.26; 'header:X-Complaints-To:1': 0.27; 'hiring': 0.29; "doesn't": 0.30; 'lines': 0.31; 'horizontal': 0.31; 'indentation': 0.31; 'writes:': 0.31; 'text': 0.33; 'open': 0.33; 'programmers': 0.33; 'style': 0.33; 'skip:s 30': 0.35; 'but': 0.35; 'changing': 0.37; 'too': 0.37; 'two': 0.37; 'easily': 0.37; 'ben': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'space': 0.40; 'gone': 0.61; 'length': 0.61; 'year.': 0.61; 'new': 0.61; 'simply': 0.61; 'first': 0.61; 'name': 0.63; 'our': 0.64; 'more': 0.64; 'jobs': 0.68; 'smith': 0.68; 'increase': 0.74; 'received:125': 0.84; 'whereas': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: PEP 8 : Maximum line Length : Date: Tue, 13 May 2014 22:26:40 +1000 References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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/23.4 (gnu/linux) Cancel-Lock: sha1:97vNAz4plCjyyxrzaicXNBJOD0k= 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: 57 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399984013 news.xs4all.nl 2889 [2001:888:2000:d::a6]:60980 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71479 Roy Smith writes: > > p = Subprocess.Popen(shlex.split(cmd), > > stdout=subprocess.PIPE, > > stderr=subprocess.PIPE) That is PEP 8 conformant, but I find it hurts maintainability: it is far too much indentation. Horizontal space is costly, because so much indentation severely limits the length of names etc. that you can use on the continuation lines. Worse, it is also needlessly tying all the continuation lines to the length of the text before the open paren. What if ‘p’ changes to some other name? With the style I've advocated:: p = Subprocess.Popen( shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) Changing the name on the first line doesn't entail changing any other line:: proc = Subprocess.Popen( shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) special_process_map[this_process] = Subprocess.Popen( shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) Whereas with your suggestion, every line would need to change simply because the first one did:: special_process_map[this_process] = Subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) Yes, that's contrived. But I prefer to use a style that doesn't need to deal with the issue of when the indentation has gone too far for a single statement. It's for both those reasons that I recommend avoiding the “align with open bracket” style, and instead use a standard eight-column indentation for continuation lines. -- \ “One bad programmer can easily create two new jobs a year. | `\ Hiring more bad programmers will just increase our perceived | _o__) need for them.” —David Lorge Parnas, 1999-03 | Ben Finney