Menu

Conventions Log in to Edit

Adam Voss

Python

  • All indents are to have 4 spaces. Tab characters should not occur.
  • All python files begin with a UTF-8 encoding declaration
    • # -*- coding: utf-8 -*-
  • Any shebangs should use /bin/env for portability reasons
    • ex. #!/usr/bin/env python2
  • Every class and function should have explanatory documentation in triple, double quotes.

Python Packages

  • Our Python code is structured in Packages
    • To allow our Modules to be imported, __init__.py files must be be contained in the directory corresponding to the package name
    • The __all__ variable must be defined in the __init__.py files in order for parts of the package to be accessible by "from ecowin import *" syntax
    • The __all__ variable is a list of strings corresponding to modules that should be imported when using the mentioned syntax
    • __init__.py can also contain initialization code that will be executed upon importation of a package's module

Related

Wiki: Home

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB