Coding style matters, the importance of PEP8

There should be one — and preferably only one — obvious way to do it.

I am the first one to have broken PEP8 compliance when I was learning the language, you can only take up so much. With more practice comes more skill, it’s a gradual process. However the more you stick to the guidelines the more readable your code is.

What concerns me though is that I am still seeing authors of educational material breaking the styleguide pretty badly.

I think everybody writing code in Python should become familiar with PEP8 and use its guidelines rather sooner than later.

More readable code saves brain cycles and leads to more maintainable code (= fewer bug). Also sharing a common coding style makes it easier to collaborate with others in the Python community.

Of course there can be exceptions to the rule, PEP8 states: “do not break backwards compatibility just to comply with this PEP!” — you don’t want to break your code base just to comply with the guidelines, pragmatism is key.

Raymond Hettinger did a great talk on this: Beyond PEP 8

We have a 5 min guide to PEP8 article on our PyBites blog. It includes links to tools to make this easier. Apart from that, just read the the full style guide at least once.

Happy coding!