<div dir="ltr"><div>Hi All,<br><br></div>I've been doing some PEP8 work using autopep8. One problem that has turned up is that the default behavior of autopep8 is version dependent. I'd like to put a script in numpy tools that runs autopep8 with some features disabled, namely<br>
<ol><li>E226 -- puts spaces around arithmetic operators (+, -, *, /, **).<br></li><li>E241 -- allows only single spaces after ','</li></ol><p>The first leaves expression formatting in the hands of the coder and avoids things like "2 ** 3". The second allows array entries to be vertically aligned, which can be useful in clarifying the values used in tests. A few other things that might need decisions:</p>
<ol><li><span style="font-family:courier new,monospace">[:,:, 2]</span> or<span style="font-family:courier new,monospace"> [:, :, 2]</span></li><li><span style="font-family:courier new,monospace"><font face="arial,helvetica,sans-serif">Blank line before first function after <span style="font-family:courier new,monospace">class</span></font> Foo():<br>
</span></li></ol><p>The advantage of having a fixed script for PEP8 compliance is that once the code is brought into compliance it will stay there and we can recommend running the script before pushing. That will not only keep the code looking neat and regular, but will also strip trailing whitespace. Of course, the autopep8 folks might make further changes in the defaults that will cause trouble in the future, but I hope that will be a minor nuisance that we can deal with. There are options for <a href="https://pypi.python.org/pypi/autopep8">autopep8</a> and <a href="https://pep8.readthedocs.org/en/latest/intro.html#error-codes">pep8</a> in case folks have other suggestions for features to add or disable.<br>
</p><p>Thoughts?</p><p>Chuck<br></p></div>