[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Vampire-public] Coding style
From: |
Nicolas Burrus |
Subject: |
[Vampire-public] Coding style |
Date: |
Fri, 9 Jan 2004 16:40:49 +0100 |
User-agent: |
KMail/1.5.4 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've just added a file HACKING, in which I've reported what I think was your
coding style rules. Here is a copy, let me know if you have comments on it.
* Coding style
Check http://www.python.org/doc/essays/styleguide.html for a reference.
Here are the main rules we use:
** Names
*** Module names
If a file only contain only one class and its closely related classes
(classes that are used only by the main class), give the same name to
the file as the class name.
Use lower_case_with_underscore otherwise.
*** Class names
Use CapWords (ex: MyBeautifulClass). Put a leading underscore if the
class is for internal use.
*** Function names
Use CapWords for functions providing major functionalities, and
lower_case_with_underscore for utility functions.
*** Method names
Same as function names. If the method is restricted (subclass can use
them, but not external code), use a leading underscore. Prefix with 2
underscores if the method is really private, that is, limited to the
scope of the current class.
*** Class attributes
Use lower_case_with_underscore. Add one leading underscore if the
attribute is protected, two underscores is the attribute is really
private to the current class scope. If you are not sure, use only one
leading underscore, this ensures extensibility.
** Comments
Add comments whenever they are USEFUL. Don't add trivial comments
everywhere, it obfuscates the code. Please comment at least tricky
code, and add a "FIXME: reason" if you think that your code should be
fixed one day.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE//suCBI1+iQ4q66sRAv9mAJ9x59abvtZzT/gO7poDn2M/s8h5zQCdH6pt
A6FvqBsLXj0NYHyPyWvbyKY=
=/5g8
-----END PGP SIGNATURE-----
- [Vampire-public] Coding style,
Nicolas Burrus <=