Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it bad that I don't follow PEP 8 and cut my lines at 79 characters?

I think every Python code has seen PEP 8. The part that sticks out to me is:

Limit all lines to a maximum of 79 characters.

I'm sitting here on a widescreen monitor and coding right across the screen. I'm not coding in a terminal and don't plan on coding in a terminal. I therefor have no problems with character-line limits.

How many people actually follow this limit? Do you still follow it if you're not coding in a 80 character limit terminal? Is it bad that I don't follow it?

I hate how this restriction is apart of 'the style guide' for Python >.<

like image 927
dave Avatar asked Oct 25 '10 07:10

dave


People also ask

Do I need to follow PEP8?

PEP8 is for humans but your program will run even if you do not follow it. If you do not share your code and do not plan to do so, do whatever you want.

Which of the following are best practices when following the guideline in PEP 8?

PEP 8 specifies the following rules for the inline comments. Start comments with the # and single space. Use inline comments carefully. We should separate the inline comments on the same line as the statement they refer.

Which choice is PEP 8 compliant as the name of a class?

I try to adhere to the style guide for Python code (also known as PEP 8). Accordingly, the preferred way to name a class is using CamelCase: Almost without exception, class names use the CapWords convention. Classes for internal use have a leading underscore in addition.

How many characters are in a line Python?

This immediately brought to mind another character limit that many Python programmers face in their day-to-day lives: the 79-character line limit suggested by Python's PEP8 style guide: Limit all lines to a maximum of 79 characters.


1 Answers

No Way.

✔ My Arguments:

  • Anything beyond 80 chars is part of less important logic. (If needed people can scroll right)
  • Enforcing this rule makes those unimportant code come in front of my eyes to clutter
  • One has to scroll vertically for huge distances all the time than horizontal scrolling occasionally
  • Most modern editors have soft-wrap feature that automates this for any choice of length limit (not just 80)
  • Soft-wrap in modern editors is a keystroke-away, it means is one could get best of both the worlds if lines were left as they are.

✔ Linus Torvalds' Arguments:

  • grep or 'find in files' will fail strings are severed at unintended location.

  • Vertical limit(VT100 terminal) is more painful than 80 char horizontal limit

✔ The verdict:

It's like try-
ing to read
a news arti-
cle written
like this.
like image 53
nehem Avatar answered Oct 04 '22 21:10

nehem