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


Groups > comp.lang.python > #71452

Re: PEP 8 : Maximum line Length :

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 <python-python-list@m.gmane.org>
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 <CACT3xuWxJHqqV26R+3aYvpovRs7OZ6_TFynSVV-n-b+EkMmtKA@mail.gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.9952.1399970767.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


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)

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


Thread

Re: PEP 8 : Maximum line Length : Peter Otten <__peter__@web.de> - 2014-05-13 10:45 +0200
  Re: PEP 8 : Maximum line Length : Rustom Mody <rustompmody@gmail.com> - 2014-05-13 06:18 -0700
  Re: PEP 8 : Maximum line Length : wxjmfauth@gmail.com - 2014-05-15 07:17 -0700
    Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-16 00:27 +1000
      Re: PEP 8 : Maximum line Length : wxjmfauth@gmail.com - 2014-05-15 08:48 -0700
      Re: PEP 8 : Maximum line Length : albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-05-17 12:52 +0000
        Re: PEP 8 : Maximum line Length : Chris Angelico <rosuav@gmail.com> - 2014-05-17 23:18 +1000
          Re: PEP 8 : Maximum line Length : Roy Smith <roy@panix.com> - 2014-05-17 09:49 -0400
        Re: PEP 8 : Maximum line Length : Tim Chase <python.list@tim.thechases.com> - 2014-05-17 08:28 -0500
          Re: PEP 8 : Maximum line Length : Roy Smith <roy@panix.com> - 2014-05-17 09:46 -0400
        Re: PEP 8 : Maximum line Length : Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-05-17 15:02 +0100
          Re: PEP 8 : Maximum line Length : Roy Smith <roy@panix.com> - 2014-05-17 10:06 -0400
            Re: PEP 8 : Maximum line Length : Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-05-17 15:21 +0100
            Re: PEP 8 : Maximum line Length : Rustom Mody <rustompmody@gmail.com> - 2014-05-17 10:46 -0700

csiph-web