gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/doc/pegboard/coding_standard--vegai peg.rst


From: Vesa Kaihlavirta
Subject: [Gzz-commits] gzz/doc/pegboard/coding_standard--vegai peg.rst
Date: Mon, 13 Jan 2003 05:23:18 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Vesa Kaihlavirta <address@hidden>       03/01/13 05:23:17

Modified files:
        doc/pegboard/coding_standard--vegai: peg.rst 

Log message:
        Added notes, recommend list comprehensions, less strict OO, answers to 
issues.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/doc/pegboard/coding_standard--vegai/peg.rst.diff?tr1=1.8&tr2=1.9&r1=text&r2=text

Patches:
Index: gzz/doc/pegboard/coding_standard--vegai/peg.rst
diff -u gzz/doc/pegboard/coding_standard--vegai/peg.rst:1.8 
gzz/doc/pegboard/coding_standard--vegai/peg.rst:1.9
--- gzz/doc/pegboard/coding_standard--vegai/peg.rst:1.8 Sun Jan 12 09:46:45 2003
+++ gzz/doc/pegboard/coding_standard--vegai/peg.rst     Mon Jan 13 05:23:17 2003
@@ -3,8 +3,8 @@
 =============================================================
 
 :Author:   Vesa Kaihlavirta
-:Last-Modified: $Date: 2003/01/12 14:46:45 $
-:Revision: $Revision: 1.8 $
+:Last-Modified: $Date: 2003/01/13 10:23:17 $
+:Revision: $Revision: 1.9 $
 :Status:   Current
 :Scope:           Minor
 :Type:     ?
@@ -15,16 +15,26 @@
 Issues
 ======
 
-- our \*.java have the license attached to every file. Is that necessary?  
+- our \*.java have the license attached to every file. Is that necessary?
 
     RESOLVED: Yes, according to FSF.
 
 - should we have automatic tests for enforcing parts of the standard?
 
+    At least for the most trivial ones (rcsid, tab check, imports, class 
names).
+    Failing tests will clearly tell what the developer did wrong.
+
 - should the rcs id variable be "rcsid" or "rcsId" ?
 
+    Probably rcsid, for consistency's sake, since it's used in our java files 
-- note
+    also item 10. in Changes.
+
+    For what it's worth, PEP008 recommends __version__ for this.
+
 - should all code and data really be in classes? If so, why?
 
+    RESOLVED: No. Rule 6 modified to catch the idea better.
+
 - should Tabs be allowed or not?
 
     Perhaps a conversion tool at "make committable"?
@@ -40,7 +50,7 @@
 2. Header comments should include authors.
 
 3. After header comments, rcsid:
-   rcsid = "$Id: peg.rst,v 1.8 2003/01/12 14:46:45 Vegai Exp $"
+   rcsid = "$Id: peg.rst,v 1.9 2003/01/13 10:23:17 Vegai Exp $"
 
 4. After rcsid, the imports (unless there's a good reason to delay
    importing).
@@ -49,14 +59,14 @@
    - Prefer "from foo import bar" to "from foo import \*".
    - No more than one import package in one line, except when importing gzz
      and java::
-        
+
         import os, sys   # Preferably no.
 
         import os        # Yes.
         import sys
 
         import gzz, java # Yes.
-   
+
 
 5. Imports should be grouped in the following order:
 
@@ -65,17 +75,30 @@
    - java imports
    - gzz imports
 
-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
+   putting state in classes instead of the module namespace. Executable code
+   in module namespace is discouraged -- except for "if __name__=='__main__':"
+
+7. Prefer list comprehensions to iterations, especially when dealing with 
lists.
+
+8. Class names are CapitalizedWords.
+
+9. Class methods and attributes are mixedCase.
+
+10. Functions are lower_case_with_underscores, variables are lowercase.
+
+11. Tab-size is 8 (will be conveted to spaces by make committable), indentation
+    at 4 spaces.
 
-7. Class names are CapitalizedWords.
+12. Never use tabs.
 
-8. Class methods and attributes are mixedCase.
 
-9. Tab-size is 8 (will be conveted to spaces by make committable), indentation 
-   at 4 spaces.
+Notes
+=====
 
-10. Never use tabs.    
+- items 8-10 are arbitrary choices for the sake of consistency
 
+- "A Foolish Consistency is the Hobgoblin of Little Minds" - Guido van Rossum
 
 
 References




reply via email to

[Prev in Thread] Current Thread [Next in Thread]