DEV Community

Cover image for Why in Python does PEP-8 set the line to a maximum of 79 characters?
Felipe Gustavo Braga
Felipe Gustavo Braga

Posted on

Why in Python does PEP-8 set the line to a maximum of 79 characters?

You may have already wondered why in Python we write code with only 79 characters per line, and there are three good reasons, one is official, and the others are just practical. Let's talk about them next:

The first reason is that, on some older monitors, the limit of columns displayed on the screen was 80 characters, so that the code wouldn't be broken in the display (who has never had this problem with a line break at the wrong time, right? ?) the code was written to fit in 80 columns.

The second reason is accessibility. Keeping few columns makes it easier for those who need larger letters, as they have some difficulty seeing. This for me was reason enough for us to use only 79 columns!

The third reason is practical. With 79 columns, you can easily mirror your code and have two editors open at the same time on an HD+ monitor. This detail when resolving a conflict or debugging the code is very useful!

And you, did you already know why use only 79 characters per line? I really enjoyed knowing! And if you want to know more style tips, you can consult Python's PEP-8, there are several tips to make your code more readable!

Top comments (0)