Skip to content
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

Imports are always put at the top of the file. Imports should be on separate lines.

Examples

Correct:

>>> import os
>>> import sys

Wrong:

>>> import sys, os

Imports should be grouped in the following order: #. Standard library imports. #. Related third party imports. #. Local application/library specific imports.

Naming convention

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

Clone this wiki locally