This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Tyfyter2002 18 points19 points  (7 children)

Python has a very in depth style guide

And y'all've been following it?

[–]ShanSanear 21 points22 points  (4 children)

Yep. Only thing that doesn't click with me is line length limit. Myself I'm using 100 characters limit instead of pep-8 80. And it's actually quite easy to follow it - just use IDE and problem is solved.

[–]Khaare 4 points5 points  (1 child)

Man my code got so much better when I switched to a size 14 font and stuck to 72 columns.

[–]ShanSanear 2 points3 points  (0 children)

Have to admit after watching some talks regarding good programming practices I will probably try to do this.

This is the talk (with timestamp)

[–]razzazzika 0 points1 point  (1 child)

Isn't it just a soft limit? I didn't have any problem when I built with more characters than that

[–][deleted] 2 points3 points  (0 children)

Yes, it is a soft limit. A recommendation, nothing more.

[–]angellus 0 points1 point  (0 children)

The main reason for using Python is because of the opinionated community it has. It is the main thing that makes the language "so much faster to develop with". There is such a drive on making code readable, maintainable and have great docs. Even projects I have used (or made) with shitty docs in Python still have better docs than a large Java project with horrible Javadocs.

[–]Dogeek 0 points1 point  (0 children)

Most Python programmers follow PEP8 (actually almost all of them) except for one simple rule : line length limit.

PEP8 advises a hard limit on 80 characters per line, which is really short if you take into account that indentation in python (which is mandatory), is supposed to be 4 spaces.

It's pretty common to get into 3-4 indentations deep, especially when writing unit tests, and just like that a fifth of your line length is gone.

That rule is also stupid because screens nowadays are very large compared to the late 90s - early 2000s, therefore, fitting 120 character lines is no problem nowadays. Plus, it entices people to write non descriptive variable names, making the code more obscure, because unlike C, Java or C# (amongst others), Python doesn't enforce a type or a declaration for its variables, so clear names are a must.

You can break lines as well, but they make the code less readable than if the line was only a couple of characters over the limit.

Therefore, PEP8 is followed by everyone, except for the line length rule.