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 -- https://mail.python.org/mailman/listinfo/python-list