edit

[Imported from Trac: page CodingStandards, version 7]
zooko 2009-11-21 04:12:53 +00:00
parent 9145ff2e00
commit 6e12b9a4cd

@ -18,7 +18,7 @@ Here is a useful header for starting new Python files:
```
# Copyright (c) 2009 Allmydata, Inc.
__copyright__ = "Copyright (c) 2009 Allmydata, Inc."
# This file is part of Tahoe-LAFS; see doc/about.html for licensing terms.
"""
doc string describing the module here
@ -26,15 +26,13 @@ doc string describing the module here
# import Python Standard Library modules here
from amdlib.util.assertutil import _assert, precondition, postcondition
from allmydata.util.assertutil import _assert, precondition, postcondition
# import from other libraries, with a blank line between each library
# your code here
```
* Files should begin with a copyright notice then a docstring about that module.
### truths and falsehoods
* Don't use the literals `True` or `False` in conditional expressions -- instead just write the expression which will evaluate to true or false. For example, write `if expr:` instead of `if expr == True:` and `if not expr:` instead of `if expr == False:`.
@ -179,7 +177,7 @@ class BlockStore:
## official Python standards
These are listed in decreasing order of priority, so if a point in one of the latter guidelines contradicts a point in one of the earlier ones, then go with the earlier. The Allmydata-specific guidelines above override all else, of course.
These are listed in decreasing order of priority, so if a point in one of the latter guidelines contradicts a point in one of the earlier ones, then go with the earlier. The Tahoe-LAFS-specific guidelines above override all else, of course.
### PEP 290