automated pep8 reformatter ?

James Mills prologic at shortcircuit.net.au
Thu Apr 14 04:36:18 CEST 2011


On Thu, Apr 14, 2011 at 12:03 PM, Ben Finney <ben+python at benfinney.id.au> wrote:
> A step forward might be the ‘reindent.py’ program included with the
> Python distribution.

I have tried to use this tool - but it lacks certain features.

Maybe I could use this as a starting point in writing such a tool :)

What I really want is to fix up common "poor" (IHMO) coding styles
in code that I have to maintain/review/etc. Things like:
* Lines longer than 80 characters
* Comments tacked on to the end of statements/expressions
* Use of ' vs. "
* More liberal use of Whitespace

Why ? Simple. Being vision impaired (in fact legally blind of <1% sight)
I find it hard to read and maintain code that exhibits poor coding style
(especially the above). -- It is of course very personal and very subjective.
(But hey maybe I should write a tool anyway!)

> Many PEP 8 violations can't be automatically fixed, they require the
> programmer to make a decision and edit the code. So first, introduce a
> code scanner that reports PEP 8 violations, such as ‘pylint’.

As stated, I'm not overly concerned with problems that a more sophisticated
static code analyzer such a pylint might find - I'm more interested in
readability more than anything. I often use pyflakes in conjunction with
pep8 to keep my own code clean, readable and consistent.

Thanks for the suggestion!

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"



More information about the Python-list mailing list