Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71459
| From | alister <alister.nospam.ware@ntlworld.com> |
|---|---|
| Subject | Re: PEP 8 : Maximum line Length : |
| Newsgroups | comp.lang.python |
| Message-ID | <PPlcv.34405$GL7.19883@fx10.am4> (permalink) |
| Organization | virginmedia.com |
| Date | 2014-05-13 09:44 +0000 |
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
Re: PEP 8 : Maximum line Length : alister <alister.nospam.ware@ntlworld.com> - 2014-05-13 09:44 +0000
csiph-web