[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: |
Vesa Kaihlavirta |
Subject: |
Re: [Gzz] PEG coding_standard--vegai: Coding Standard (revised) |
Date: |
Wed, 5 Feb 2003 18:07:14 +0200 |
User-agent: |
KMail/1.5 |
On Wednesday 05 February 2003 08:44, Tuomas Lukka wrote:
> > 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.
I'll look into it.
> > 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?
Ah, yes. Fixed.
> > 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
But "prefer something" implies "if necessary, break this rule", does it not?
> > 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?
This was Benja's comment from few weeks back, and it faced no
opposition then. I don't find it important personally.
> > 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.
Rephrased:
10. Tab-size is 8, indentation at 4 spaces.
11. Run make committable before committing code.
- converts tabs to 8 spaces
- runs tests
--
V.K.