/[gzz]/gzz/doc/pegboard/coding_standard--vegai/peg.rst
ViewVC logotype

Diff of /gzz/doc/pegboard/coding_standard--vegai/peg.rst

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by Vegai, Sun Jan 12 14:46:45 2003 UTC revision 1.9 by Vegai, Mon Jan 13 10:23:17 2003 UTC
# Line 15  large and growing amount of python code. Line 15  large and growing amount of python code.
15  Issues  Issues
16  ======  ======
17    
18  - our \*.java have the license attached to every file. Is that necessary?    - our \*.java have the license attached to every file. Is that necessary?
19    
20      RESOLVED: Yes, according to FSF.      RESOLVED: Yes, according to FSF.
21    
22  - should we have automatic tests for enforcing parts of the standard?  - should we have automatic tests for enforcing parts of the standard?
23    
24        At least for the most trivial ones (rcsid, tab check, imports, class names).
25        Failing tests will clearly tell what the developer did wrong.
26    
27  - should the rcs id variable be "rcsid" or "rcsId" ?  - should the rcs id variable be "rcsid" or "rcsId" ?
28    
29        Probably rcsid, for consistency's sake, since it's used in our java files -- note
30        also item 10. in Changes.
31    
32        For what it's worth, PEP008 recommends __version__ for this.
33    
34  - should all code and data really be in classes? If so, why?  - should all code and data really be in classes? If so, why?
35    
36        RESOLVED: No. Rule 6 modified to catch the idea better.
37    
38  - should Tabs be allowed or not?  - should Tabs be allowed or not?
39    
40      Perhaps a conversion tool at "make committable"?      Perhaps a conversion tool at "make committable"?
# Line 49  These apply to all \*.py (and possibly \ Line 59  These apply to all \*.py (and possibly \
59     - Prefer "from foo import bar" to "from foo import \*".     - Prefer "from foo import bar" to "from foo import \*".
60     - No more than one import package in one line, except when importing gzz     - No more than one import package in one line, except when importing gzz
61       and java::       and java::
62            
63          import os, sys   # Preferably no.          import os, sys   # Preferably no.
64    
65          import os        # Yes.          import os        # Yes.
66          import sys          import sys
67    
68          import gzz, java # Yes.          import gzz, java # Yes.
69      
70    
71  5. Imports should be grouped in the following order:  5. Imports should be grouped in the following order:
72    
# Line 65  These apply to all \*.py (and possibly \ Line 75  These apply to all \*.py (and possibly \
75     - java imports     - java imports
76     - gzz imports     - gzz imports
77    
78  6. All code and data should preferably reside inside a class.  6. Code should be structured so that it can be imported and re-used, for example by
79       putting state in classes instead of the module namespace. Executable code
80       in module namespace is discouraged -- except for "if __name__=='__main__':"
81    
82    7. Prefer list comprehensions to iterations, especially when dealing with lists.
83    
84    8. Class names are CapitalizedWords.
85    
86    9. Class methods and attributes are mixedCase.
87    
88    10. Functions are lower_case_with_underscores, variables are lowercase.
89    
90    11. Tab-size is 8 (will be conveted to spaces by make committable), indentation
91        at 4 spaces.
92    
93  7. Class names are CapitalizedWords.  12. Never use tabs.
94    
 8. Class methods and attributes are mixedCase.  
95    
96  9. Tab-size is 8 (will be conveted to spaces by make committable), indentation  Notes
97     at 4 spaces.  =====
98    
99  10. Never use tabs.      - items 8-10 are arbitrary choices for the sake of consistency
100    
101    - "A Foolish Consistency is the Hobgoblin of Little Minds" - Guido van Rossum
102    
103    
104  References  References

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26