Author: | Ben Finney <ben+python@benfinney.id.au> |
---|---|
Updated: | 2009-12-27 |
./ Top level of source tree doc/ Project documentation bin/ Executable programs gracied Main program daemon gracie/ Gracie library code test/ Unit tests
All Python code should conform to the guidelines in PEP8. In particular:
Indent each level using 4 spaces (U+0020 SPACE), and no TABs (U+0008 CHARACTER TABULATION).
Name modules in lower case, multiplewordslikethis.
Name classes in title case, MultipleWordsLikeThis.
Name functions, instances and other variables in lower case, multiple_words_like_this.
Every module, class, and function has a Python doc string.
Doc strings are written as triple-quoted strings.
Example:
def frobnicate(spam): """ Perform frobnication on ``spam``. The frobnication is done by the Dietzel-Venkman algorithm, and optimises for the case where ``spam`` is freebled and agglutinative. """ spagnify(spam) # …
All import statements appear at the top of the module.
Each import statement imports a single module, or multiple names from a single module.
Example:
import sys import os from spam import foo, bar, baz
Additional style guidelines:
All code should aim for 100% coverage by unit tests. New code, or changes to existing code, will only be considered for inclusion in the development tree when accompanied by corresponding additions or changes to the unit tests.
Where possible, practice test-driven development to implement program code.
Test-driven development is not absolutely necessary, but is the simplest, most direct way to generate the kind of program changes accompanied by unit tests that are necessary for inclusion in the project.