Hacker News new | ask | show | jobs
by antihero 4905 days ago
80 character line length increases readability, and four spaces means that this is consistent everywhere.

If you have a tab character and someone sets things to like, two spaces, their line is going to be a dynamic length and it's going to shit up the code. PEP-8 looks fantastic, works, and leads to consistency across all Python code. Unless you are using a shitty IDE/editor, adhering to it is totally easy and completely painless.

1 comments

I do not understand why there seem to be so much agreement on 80 characters line length. I often use 132 character. I have a rule that invite to avoid abbreviations in identifiers and I have often 4 spaces. If I limit to 80 character, all the line breaks decrease significantly readability.
Code is just like literature. Too many words on a line and it looses the reader. All of this indeed depends on the density of the language you're using. If your're using extremelyLongVariableNames it may be ok to use 132 characters per lines but if you use shorter var_names, 80 characters is plenty of room to express yourself^W^Wwrite code.

Also, unix. Stop arguing about religion.

I understand the readability argument for literature, where lines of text are left-justified. In code though, indentation is much more prevalent. Between indentation and alignment, some lines of code are unsettlingly clipped to a small fraction of the available 80 characters.

I still recommend wrapping at 80 chars though.

80 column punch cards are at times implied as the reason for 80 column displays. There are just some solutions that stick.