Use Standards Wisely - Clean Code
Posted by __eraki__@reddit | Python | View on Reddit | 19 comments
"Standards make it easier to reuse ideas and components, recruit people with relevant experience, encapsulate good ideas, and wire components together. However, the process of creating standards can sometimes take too long for industry to wait, and some standards lose touch with the real need of the adopters they are intended to serve."
Dr. Kevin Dean Wampler Clean Code
In my hummple opinion, Standards are mandatory to follow, but don't be fanatic.
I'd like to hear yours!
Historical_Bid_2669@reddit
As someone who's worked on several Python codebases over the years, I think Dr. Wampler's perspective is spot on. Standards are incredibly valuable as guidelines, not rigid rules.
In Python, PEP 8 gives us a fantastic baseline, but the Zen of Python reminds us that "practicality beats purity." I've seen teams get so caught up in linting rules that they lose sight of delivering functional code.
The best approach I've found is to use standards as a framework that serves your team and project goals. For example, I might strictly adhere to naming conventions and docstring formats for public APIs, but be more flexible with internal code.
Remember that standards evolve too - Python itself has changed significantly over time while maintaining backward compatibility where possible. The goal is clean, maintainable code that others (including future you) can understand.
What specific standards do you find most helpful in your Python projects?
the_real_tobo@reddit
`pep8 on to thyself and not to others` - Raymond Hettinger
__eraki__@reddit (OP)
I'd like to THANK you all; That was an amazing weekend discussion.
PossibilityTasty@reddit
Or as PEP 8 calls it:
Arguably the most skipped paragraph of PEP 8.
__eraki__@reddit (OP)
Yeah, that's a good one.

cgoldberg@reddit
Follow PEP8
__eraki__@reddit (OP)
Totally Agree 💯 But sometimes it's hard to stick with all PEP standards; I am wondering if there's a Vscode extension for that purpose? Or any other way!
cgoldberg@reddit
There's several. I use black and flake8 for linting.
__eraki__@reddit (OP)
Thank you 😊 I will give it a try.
bunchedupwalrus@reddit
Seconded on ruff. It’s fast enough that I don’t even notice it, whereas the list of other tools I’d run would be up to a minute on a large commit
__eraki__@reddit (OP)
Grove_street_home@reddit
Try Ruff linter and Ruff formatter instead. They've practically superseded flame8 and black because they're much faster.
Try to include them in your precommit if you use git.Â
__eraki__@reddit (OP)
Yeah, that is pretty good too.
stibbons_@reddit
Use black+pylint or ruff and focus on real issues
__eraki__@reddit (OP)
Yeah, I tried the pylint command before; it's a pretty good command.
Also, I think the extension provides the same output, without auto-configure the code, which I prefer.
Thank you u/stibbons_
covmatty1@reddit
The one existing comment here of "use PEP8" is precisely the evidence of the quote you posted, and shows why it is correct.
It is the textbook definition of standards "losing touch" with reality - is 79 characters really still the right maximum line length?
This is a perfect example of where adaptations can be made to standards that have a logical benefit. Setting your linter to 120 characters instead is a much more sensible standard for 2025, and the kind of thing I would happily set across my team.
Following a consistent standard is absolutely mandatory. But it doesn't always need to be the textbook traditional one, some deviations are entirely sensible, and as long as they are applied consistently across projects and teams, this is perfectly ok.
__eraki__@reddit (OP)
Exactly, and that's what I meant with 'don't be fanatic';
Ultimately, the Standards Creator is a human and made such rules from his point of view and the circumstances/available technologies around him.
I agree with, consistent with standards, and appending sensible deviations that meet your situations.
EternityForest@reddit
I've almost never regretted following a common software standard like ASGI or using SQLite or being fanatical about automated tests.
Trying to create new standards is way harder. I've generally had bad results with "meta projects", like "I'm gonna make all these things use RJ45 connectors with this one pinout.
Mediocre but compatible stuff is often way more pleasant to work with then shiny new stuff you have to maintain all by yourself that nobody else uses.
__eraki__@reddit (OP)
Sometimes it's out of our hands ðŸ˜. Some companies tend to append their own Standards to the common one.