- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are Python coding standards/best practices?
You can use the PEP8 guide as a holy grail. Almost all python world uses this guide to write clean understandable and standard python code. This is available as an extension as a linter for all modern text editors. You can check it out at http://www.python.org/dev/peps/pep-0008/
Properly Structure your folders. All projects need proper structuring. This helps organize code better. Python has an opinionated folder structure that you should use.
README.rst LICENSE setup.py requirements.txt sample/__init__.py sample/core.py sample/helpers.py docs/conf.py docs/index.rst tests/test_basic.py tests/test_advanced.py
Use doctests. The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work exactly as shown. This is one of the best and most useful peices of the language and you should use it to the max. This allows doing TDD.
Use PyPi to get all your modules. PyPi is a central repository of python modules. Instead of building your own packages, use pip to install modules off of Pypi.
Write Pythonic code by adhering to python idioms. This takes some getting used to but can help you go a long way. You can read more about idiomatic python on
- What are the best practices to organize Python modules?
- What are the best practices for using loops in Python?
- What are the best practices for exception handling in Python?
- What are the best practices for using if statements in Python?
- What are favicon best practices regarding size and format?
- What are the best practices for committing in Git?
- What are the best practices to improve jQuery selector performance?
- Openssh security best practices
- Why is python best suited for Competitive Coding
- C# Exception Handling Best Practices
- Java variable declaration best practices
- Best practices for Java comments.
- Acquiring Resources – Best Practices!