|
The Tryton Project strongly recommends the following guidelines for code contributed to the Tryton framework and modules: - Code style follows in general PEP 8
- If unsure about PEP 8 conformity use pylint to check the code
- Good practices for coding in Tryton:
- Use doc-strings and comments in your code
- Only use keyword arguments when defining a constructor method.
- Never pass keyword arguments as positional arguments when calling a method.
- In the very beginning (right under the doc-string) of a method definition, define all your objects you will use (self.pool.get(...)).
- Try to use the browse instead of the read method.
- Naming of modules, classes, variables
- A name should be as descriptive and as short as possible
- Naming structure of a model or module must follow these rules:
- First part left of the name is the general functioning of the module or model,
- after this comes the less general name parts (= the more specific name parts) of the module or model
- If you are unsure with naming, please request first on the mailing list or on the IRC channel #tryton
- For naming modules we use underscore for separating the name parts
- For naming classes we use CamelCase
- For naming methods we use underscore for separating the name parts
|