Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed4a.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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:PEP': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'cmd': 0.16; 'newlines': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'variables:': 0.16; 'wrote:': 0.18; 'module': 0.19; 'example': 0.22; 'import': 0.22; 'rules': 0.22; 'header:User-Agent:1': 0.23; 'helper': 0.24; 'subject: : ': 0.26; 'header:X-Complaints-To:1': 0.27; 'character': 0.29; 'characters': 0.30; 'lines': 0.31; 'pipe': 0.31; 'open': 0.33; 'says': 0.33; 'running': 0.33; 'skip:s 30': 0.35; 'tool': 0.35; '(2)': 0.35; 'too': 0.37; 'expected': 0.38; '(3)': 0.38; 'to:addr:python-list': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'length': 0.61; 'skip:* 10': 0.61; 'maximum': 0.63; 'limit': 0.70; 'introduce': 0.78; 'exceeding': 0.84; 'skip:s 80': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Peter Otten <__peter__@web.de> Subject: Re: PEP 8 : Maximum line Length : Date: Tue, 13 May 2014 10:45:49 +0200 Organization: None References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Gmane-NNTP-Posting-Host: p57bdab25.dip0.t-ipconnect.de User-Agent: KNode/4.11.5 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: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399970767 news.xs4all.nl 2884 [2001:888:2000:d::a6]:54769 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71452 Ganesh Pal wrote: > Hi Team , > > > what would be the best way to intent the below line . > > I have few lines in my program exceeding the allowed maximum line Length > of 79./80 characters > > Example 1 : > > p = > Subprocess.Popen(shlex.split(cmd),stdout=subprocess.PIPE,stderr=subprocess.PIPE) > > > Iam running pylint and it says the above line is tool long how do I limit > it to 79 character without violating any rules > > ************* Module isi_corrupt > C: 14,0: Line too long (88/80) > W: 19,0: Bad indentation. Found 6 spaces, expected 8 (1) Newlines are allowed inside an open (, [, or {. So: p = subprocess.Popen( shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE) Other techniques: (2) Introduce helper variables: cmd = shlex.split(cmd) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (3) Import names: from subprocess import PIPE p = subprocess.Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE) (4) Use aliases: import subprocess as sp p = sp.Popen(shlex.split(cmd), stdout=sp.PIPE, stderr=sp.PIPE)