python - Matching indentation level according to PEP8/flake8 -
the question how break lines according pep8 while using tabs.
so here related question how break line in function definition in python according pep8. issue works when length of definition header def dummy(
integer multiple of tab length.
def tes(para1=x, --->--->para2=y)
otherwise end new error , flake8 complains error e127 or e128 because either over- or under-indented this:
under-indented e128
def test(para1=x, --->--->para2=y)
over-indented
def te(para1=x, --->--->para2=y)
a solution flake8 not complain do:
def test( --->--->para1=x, --->--->para2=y --->--->)
however, when programming don't know in advance how many parameters i'm gonna use in test()
function. once hit line limit have rearrange quite bit.
this apply continuations. mean cleanest solution break line possible every line final length cannot said time of first writing, or there solution.
tab , space shall not mixed solution.
so ask myself legis artis deal line continuations?
i'm turning original comment official answer.
the pep-0008 has section whether use tabs or spaces, quoted below (with emphasis):
spaces preferred indentation method.
tabs should used solely remain consistent code indented tabs.
python 3 disallows mixing use of tabs , spaces indentation.
python 2 code indented mixture of tabs , spaces should converted using spaces exclusively.
when invoking python 2 command line interpreter -t option, issues warnings code illegally mixes tabs , spaces. when using -tt these warnings become errors. these options highly recommended!
you're running issues tabs, , don't whether you're using python2 or 3, i'd suggest stick pep-0008 guidelines.
you should replace tab chars in file/module 4 spaces , use spaces exclusively when indenting.
warning: careful if plan use shell commands you, commands can dangerous , mangle intended tab chars within strings (i.e. not indentation tabs) , can break other things, such repositories -especially if command recursive.
Comments
Post a Comment