[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gzz] PEG coding_standard--vegai: Coding Standard (revised)
From: |
Tuomas Lukka |
Subject: |
Re: [Gzz] PEG coding_standard--vegai: Coding Standard (revised) |
Date: |
Wed, 5 Feb 2003 08:44:48 +0200 |
User-agent: |
Mutt/1.4i |
On Wed, Feb 05, 2003 at 04:58:44AM +0200, Vesa Kaihlavirta wrote:
> 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).
Would be nice to have a rationale for this; without it may seem arbitrary.
> 2. Header comments should include authors.
>
> 3. After header comments, rcsid:
> rcsid = "$Id: peg.rst,v 1.12 2003/02/04 18:46:12 Vegai Exp $"
Wasn't an issue resolved differently?
> 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.
Exceptions: importing from current package, i.e.
in gzz/view/buoy/buoymanager.py,
from gzz.view.buoy import *
should be ok
> 5. Imports should be grouped in the following order:
>
> - standard python imports
> - 3rd party python imports
> - java imports
> - gzz imports
>
> * imports should be in alphabetical order in the groups
alphabetical? Why in the world?
> 10. Tab-size is 8 (will be converted to spaces by make committable),
> indentation
> at 4 spaces.
>
> 11. Never use tabs.
Like mudyc said, this could probably be expressed better.
> Notes
> =====
>
> - items 8-12 are arbitrary choices for the sake of consistency
Not really; e.g. tab-size 8 is a standard in unix, and indenting
4 stops is because 8 becomes easily too much to remain within 80 chars.
Tuomas