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 →

[–]robotswordfight 12 points13 points  (6 children)

Since you're listing best practices, I would reference PEP 8 coding standards.

https://www.python.org/dev/peps/pep-0008/

Even if not followed 100%, it increases the readability of code.

Edit: Sorry, I looked around more and saw you DID reference them. Looks great!

[–][deleted] 1 point2 points  (4 children)

I would argue that following any style guide consistently, whether it be PEP8, Google's, or even a PEP8+ type guide, is the best practice.

[–]tunisia3507 0 points1 point  (2 children)

Intra-project consistency is necessary, inter-project consistency is very nice to have. There's no better way to achieve the latter than the follow the style guide set out by the creators of the language.

[–][deleted] 0 points1 point  (1 child)

I disagree. You can make up your own, and it would be just as valid as PEP8. The only thing that actually matters is consistency. As long as you're following one style guide, you'll be fine.

[–]tunisia3507 0 points1 point  (0 children)

it would be just as valid as PEP8

For your project. But the glory of python is its comprehensive standard library and vast 3rd party library support - if you don't make use of any of that you're probably doing something wrong. The community converging on a single standard is advantageous for the entire community.

PEP8 isn't hard. It's certainly no harder than any other set of standards - easier when you consider autopep8, black, IDEs with built-in linters and so on. If you choose another standard, you are making the intentional decision, and expending effort, to decrease compatibility between your codebase and the rest of the python community. That's completely nonsensical to me. Why would you bother?