Le mardi 13 mai 2014 10:45:49 UTC+2, Peter Otten a écrit : > 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)
===== One another trick is to drop spaces around keywords >>> 99999and 12345or 9999999999if 'a'in'a' else 88888888or 777777 12345 and pray, the tools from those who are wasting their time in writing code analyzers or syntax colorizers or doc strings collectors or ... are finally working. Depending of the tools the interpretation may vary, but definitely all are producing erroneous results. jmf -- https://mail.python.org/mailman/listinfo/python-list