gzz-dev
[Top][All Lists]
Advanced

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

[Gzz] PEG coding standard


From: Vesa Kaihlavirta
Subject: [Gzz] PEG coding standard
Date: Sun, 12 Jan 2003 17:15:34 +0200
User-agent: KMail/1.5

=============================================================
PEG coding_standard--vegai: Coding Standard
=============================================================

:Author:   Vesa Kaihlavirta
:Last-Modified: $Date: 2003/01/12 14:39:03 $
:Revision: $Revision: 1.7 $
:Status:   Current
:Scope:    Minor
:Type:     ?

Our coding standard (/gzz/CODING) requires revising, mainly because of the
large and growing amount of python code.

Issues
======

- 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?

- should the rcs id variable be "rcsid" or "rcsId" ?

- should all code and data really be in classes? If so, why?

- should Tabs be allowed or not?

    Perhaps a conversion tool at "make committable"?

Changes
=======

These apply to all \*.py (and possibly \*.test).

1. Header comments should include full module name of the file (eg.
   gzz/modules/pp/demotest.py would have gzz.modules.pp.demotest).

2. Header comments should include authors.

3. After header comments, rcsid:
   rcsid = "$Id: peg.rst,v 1.7 2003/01/12 14:39:03 Vegai Exp $"

4. After rcsid, the imports (unless there's a good reason to delay
   importing).

   - Prefer "import foo" to "from foo import bar".
   - 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:

   - standard python imports
   - 3rd party python imports
   - java imports
   - gzz imports

6. All code and data should preferably reside inside a class.

7. Class names are CapitalizedWords.

8. Class methods and attributes are mixedCase.

9. Tab-size is 8 (will be conveted to spaces by make committable), indentation 
   at 4 spaces.

10. Never use tabs.     



References
==========

http://www.python.org/doc/essays/styleguide.html
http://www.python.org/peps/pep-0008.html
http://www.wikipedia.org/wiki/CamelCase





reply via email to

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