PyCon UK 2019

Code Styles Aren’t Black and White
2019-09-14, 12:30–13:00, Assembly Room

We all have a code style. We all have opinions how code should look. We all seem to love (and hate) having long arguments about which code styles are better. What if there was a way out of the bikeshedding?


Code styles are important to us. So important that we’re willing to spend lots of time and energy debating the various intricacies of our favourite ones, over and over again. Do these arguments really warrant the amount of energy, IRC messages and forum posts that we’ve wasted on them?

A code style is a set of idioms and patterns that we deploy, either consciously or unconsciously, that is concerned with making code readable to us as writers, reviewers and maintainers. When we read code, we want to understand it functionally. However, code styles vary between projects and developers. Unfamiliar code styles hide bugs, slow down the process of understanding code and can even lead to a breakdown in comprehension. Inconsistency in code styles is therefore a problem. As Python developers, we fortunately have the PEP-8 style guide to help us. But a guide is still just a guide, not a set of rules, and even a guide can be followed inconsistently.

What if there was a solution both to the endless bikeshedding and a way of producing a consistent code style across all the Python code we write as a community?

In this talk, I’d like to discuss what code styles are and why they’re important to us, how Palaeolithic humanity was having arguments about line lengths, the values of standardisation in industrial production, and to suggest an approach out of the code style conundrum.


Is your proposal suitable for beginners? – yes