-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Jie edited this page Apr 22, 2022
·
4 revisions
Welcome to the graph-compiler wiki!
This is an overview of the PEP 8 formatting guidelines. Refer to the user full guide for further details, which can be found at https://github.com/python/peps/blob/main/pep-0008.txt.
Imports are always put at the top of the file. Imports should be on separate lines.
Correct:
>>> import os
>>> import sysWrong:
>>> import sys, osImports should be grouped in the following order: #. Standard library imports. #. Related third party imports. #. Local application/library specific imports.
Naming convention is as follows:
- Functions: All lowercase, with words separated by underscores as necessary to improve readability
- Variables: Same convention as function names
- Classes: Start each word with a capital letter. Do not separate words with underscores. This style is called camel case
- Methods: Use a lowercase word or words. Separate words with underscores to improve readability.
- Constants: Use an uppercase single letter, word, or words. Separate words with underscores to improve readability.
- Modules: Use a short, lowercase word or words. Separate words with underscores to improve readability.
- Packages: Use a short, lowercase word or words. Do not separate words with underscores.
Never use l, o, or I single letter names as these can be mistaken for 1 and 0, depending on typeface