- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
- Python Advanced Tutorial
- Python - Classes/Objects
- Python - Reg Expressions
- Python - CGI Programming
- Python - Database Access
- Python - Networking
- Python - Sending Email
- Python - Multithreading
- Python - XML Processing
- Python - GUI Programming
- Python - Further Extensions
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
- Related Articles
- Coding standards (style guide) for Python programs?
- 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 the Best Practices in Visual Marketing?
- What are the “best practices” for using import in a Python module?
- What are favicon best practices regarding size and format?
- What are the best practices for committing in Git?
- Why is python best suited for Competitive Coding
- What are the best practices to improve jQuery selector performance?
- What are the Best Practices to Improve CRM User Adoption?