Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71459

Re: PEP 8 : Maximum line Length :

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.roellig-ltd.de!open-news-network.org!cyclone03.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!post01.fr7!fx10.am4.POSTED!not-for-mail
From alister <alister.nospam.ware@ntlworld.com>
Subject Re: PEP 8 : Maximum line Length :
Newsgroups comp.lang.python
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Lines 64
Message-ID <PPlcv.34405$GL7.19883@fx10.am4> (permalink)
NNTP-Posting-Host 82.5.246.13
X-Complaints-To http://netreport.virginmedia.com
X-Trace 1399974255 82.5.246.13 (Tue, 13 May 2014 09:44:15 UTC)
NNTP-Posting-Date Tue, 13 May 2014 09:44:15 UTC
Organization virginmedia.com
Date Tue, 13 May 2014 09:44:15 GMT
X-Received-Body-CRC 1687688992
X-Received-Bytes 2329
Xref csiph.com comp.lang.python:71459

Show key headers only | View raw


On Tue, 13 May 2014 10:45:49 +0200, Peter Otten wrote:

> 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)

or simply leave it alone
Pep 8 is a guide not a "Set in Stone" rule & even pep 8 does say that the 
80 character limit can be exceeded if breaking the line would make the 
code less readable





-- 
Catastrophic failure of the IDE cable???.
What are you doing to the poor thing, jumping on it?

	- Beau Kuiper on linux-kernel

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: PEP 8 : Maximum line Length : alister <alister.nospam.ware@ntlworld.com> - 2014-05-13 09:44 +0000

csiph-web