18 |
|
|
19 |
These apply to all \*.py (and possibly \*.test). |
These apply to all \*.py (and possibly \*.test). |
20 |
|
|
21 |
1) Header comments should include full module name of the file (eg. |
1. Header comments should include full module name of the file (eg. |
22 |
gzz/modules/pp/demotest.py would have gzz.modules.pp.demotest). |
gzz/modules/pp/demotest.py would have gzz.modules.pp.demotest). |
23 |
|
|
24 |
2) Header comments should include authors. |
2. Header comments should include authors. |
25 |
|
|
26 |
3) After header comments, rcsid: |
3. After header comments, rcsid: |
27 |
rcsid = "$Id$" |
rcsid = "$Id$" |
28 |
|
|
29 |
4) After rcsid, the imports (unless there's a good reason to delay |
4. After rcsid, the imports (unless there's a good reason to delay |
30 |
importing). |
importing). |
31 |
|
|
32 |
- Prefer "import foo" to "from foo import bar". |
- Prefer "import foo" to "from foo import bar". |
33 |
- Prefer "from foo import bar" to "from foo import \*". |
- Prefer "from foo import bar" to "from foo import \*". |
34 |
- No more than one import package in one line, eg.: |
- No more than one import package in one line, eg.:: |
35 |
|
|
36 |
import os, sys # NO |
import os, sys # NO |
37 |
|
|
38 |
import os # Yes. |
import os # Yes. |
39 |
import sys |
import sys |
40 |
|
|
41 |
5) Imports should be grouped in the following order: |
5. Imports should be grouped in the following order: |
42 |
|
|
43 |
- standard python imports |
- standard python imports |
44 |
- 3rd party python imports |
- 3rd party python imports |
45 |
- java imports |
- java imports |
46 |
- gzz imports |
- gzz imports |
47 |
|
|
48 |
6) All code and data should preferably reside inside a class. |
6. All code and data should preferably reside inside a class. |
49 |
|
|
50 |
7) Class names are CapitalizedWords. |
7. Class names are CapitalizedWords. |
51 |
|
|
52 |
8) Class methods are mixedCase. |
8. Class methods are mixedCase. |
53 |
|
|
54 |
9) Class attributes are lowercase. |
9. Class attributes are lowercase. |
55 |
|
|
56 |
10) Tab-size is 4. |
10. Tab-size is 4. |
57 |
|
|
58 |
11) Never use tabs. |
11. Never use tabs. |
59 |
|
|
60 |
|
|
61 |
Questions |
Questions |