automated pep8 reformatter ?

Ben Finney ben+python at
Wed Apr 13 23:06:34 EDT 2011

James Mills <prologic at> writes:

> 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

Most of those don't have sensible automated responses. There aren't good
automatic answers to “where should this line of code be broken to fit
within 80 columns?” or “where should this end-line comment go instead?”.

> 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!)

If you come up with algorithmic answers to all the above problems, yes,
you could write such a tool. But I doubt it would be generally
applicable; and consequently, I doubt that a generally-applicable tool
already exists that fits your tastes.

 \      “I tell you the truth: some standing here will not taste death |
  `\    before they see the Son of Man coming in his kingdom.” —Jesus, |
_o__)                             c. 30 CE, as quoted in Matthew 16:28 |
Ben Finney

More information about the Python-list mailing list