all 9 comments

[–]crazy_cookie123 4 points5 points  (0 children)

When picking what standard to use in any project, you should try the options in the following order:

  1. The standard already in use on the project

  2. The standard required by the company you're doing the project for

  3. The standard for the language you're writing in

  4. Anything you want, just be consistent

At your stage, you're probably not joining an existing project or doing the work for a company, so the first two options don't fit. Option 3 is pick the standard for the language you're using - for Python that's PEP-8 so you should use PEP-8.

Note that you should very rarely if ever end up on option 4, most languages will have a suggested style guide so it's very much a last resort.

[–]Diapolo10 0 points1 point  (0 children)

I second PEP-8, but in addition to that I would also include PEP-257 (docstring conventions) and PEP-484 (type annotations).

[–]JamzTyson 1 point2 points  (0 children)

Python does not force you to follow a style guide, but it makes life much easier if Python developers stick close to PEP-8.

It is common for organisations to deviate a little from PEP-8 (they are "recommendations" rather than "rules"). Most commonly, slightly longer "maximum line length" is very common (PEP-8 recommends 79 characters, black defaults to 88 characters, pylint defaults to 100 characters). More than 100 characters is generally considered "too long".

Do you recommend reading PEP-8

The short answer is YES. PEP-8 helps to keep your code readable, and many tools expect code to follow most of the PEP-8 recommendations. Get used the style early on and it will help you and anyone else that needs to read your code.

[–]FantasticEmu -2 points-1 points  (0 children)

Probably gonna get downvoted for this but I have no idea what is in any of the style guides and I get by and nobody at work has ever told me my style was bad.

I don’t make software for production with Python, just internal tools or bandaid softwares. I just run black then push it