[Numpy-discussion] PEP8

Benjamin Root ben.root at ou.edu
Mon Sep 9 09:56:47 EDT 2013

On Sat, Sep 7, 2013 at 7:56 PM, Charles R Harris
<charlesr.harris at gmail.com>wrote:

> Hi All,
> 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
>    1. E226 -- puts spaces around arithmetic operators (+, -, *, /, **).
>    2. E241 -- allows only single spaces after ','
> Something we have done in matplotlib is that we have made PEP8 a part of
the tests. We are transitioning, but the idea is that eventually, with
Travis, all pull requests will get PEP8 checked. I am very leary of
automatic PEP8-ing. I would rather have the tests fail and let me manually
fix it rather than have code automatically changed.

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:
>    1. [:,:, 2] or [:, :, 2]
>    2. Blank line before first function after class Foo():
> For the first one, I prefer spaces. For the second one, I prefer no blank

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130909/df1e64ce/attachment.html>

More information about the NumPy-Discussion mailing list