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, except when importing gzz |
35 |
|
and java:: |
36 |
|
|
37 |
import os, sys # NO |
import os, sys # Preferably no. |
38 |
|
|
39 |
import os # Yes. |
import os # Yes. |
40 |
import sys |
import sys |
41 |
|
|
42 |
|
import gzz, java # Yes. |
43 |
|
|
44 |
|
|
45 |
5. Imports should be grouped in the following order: |
5. Imports should be grouped in the following order: |
46 |
|
|
47 |
- standard python imports |
- standard python imports |
48 |
- 3rd party python imports |
- 3rd party python imports |
49 |
- java imports |
- java imports |
50 |
- gzz imports |
- gzz imports |
51 |
|
|
52 |
6. All code and data should preferably reside inside a class. |
6. All code and data should preferably reside inside a class. |
53 |
|
|
54 |
7. Class names are CapitalizedWords. |
7. Class names are CapitalizedWords. |
55 |
|
|
56 |
8. Class methods are mixedCase. |
8. Class methods and attributes are mixedCase. |
|
|
|
|
9. Class attributes are lowercase. |
|
57 |
|
|
58 |
10. Tab-size is 4. |
9. Tab-size is 4. |
59 |
|
|
60 |
11. Never use tabs. |
10. Never use tabs. |
61 |
|
|
62 |
|
|
63 |
Questions |
Questions |