Python coding style guidelines

From Salix OS
Jump to: navigation, search

Contents

Python style guide

JRD has revised the codebase to conform with PEP 8 - please try to keep to this style

Please see the official guide to PEP 8

Key points:

It may be useful to use a checker such as this one (maybe someone knows of a better one?).

Code should be forward-compatible with Python 3 as far as possible

  • don't rely on / for ints returning the quotient rather than a float, if there would be a remainder
  • print is a function [code]print("Text")[/code]
  • import from local directory doesn't work
  • unicode is the default encoding for strings

Comments and docstrings

  • In general, code to help others collaborate in development in the future, creating easily maintained code