PEP8 compliance

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Jun 13 11:45:07 EDT 2018


On Wed, 13 Jun 2018 08:04:27 -0700, T Berger wrote:

> Sorry for this basic question, but to change my code if it's failed the
> PEP8 test, what code do I use to open my program and make changes?

Use your text editor to modify the source code of the program.


I'm of two minds here... on the one hand, I think that generally 
speaking, PEP 8 is a good style guide to follow, and I think that in the 
long run using a consistent style is a good habit to get into.

On the other hand, some people follow PEP 8 religiously, except for the 
most important rule of all: the one about knowing when to break all the 
other rules. They can get obsessed with following PEP 8 rules even when 
it makes the code *worse*. I don't want to encourage that way of thinking.

(Making purely stylistic changes to working code is also a good way to 
avoid doing actual productive work while still looking busy.)

On the third hand, you're a beginner and you may be finding this whole 
experience confusing enough without also being told off by the computer 
because you wrote "x+1" instead of "x + 1". I don't find that helpful for 
beginners.

So use your own judgement: if following PEP 8 becomes a chore, or if you 
would rather follow your own style, don't feel guilty about ignoring the 
style guide.



-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list