|
|
# [PEP-Standard](https://www.python.org/dev/peps/pep-0008/)
|
|
|
We follow the [PEP-Standard](https://www.python.org/dev/peps/pep-0008/) quite close.
|
|
|
Every python file has to follow these coding rules.
|
|
|
There are some exceptions. We allow:
|
|
|
* variable names of length 1
|
|
|
* 120 characters in a single line instead of 80
|
|
|
|
|
|
You can use [Pylint](https://www.pylint.org/) and the `pylint.rc` in the PYMESS sources to check your code.
|
|
|
|
|
|
**If you have GOOD reasons to not follow these rules**, then you can deactivate `pylint` for some code pieces
|
|
|
using special syntax:
|
|
|
|
|
|
# pylint: disable=line-too-long
|
|
|
|
|
|
**Do not use this because you are too lazy to follow the [PEP-Standard](https://www.python.org/dev/peps/pep-0008/)!**
|
|
|
|
|
|
A useful tool is [YAPF](https://github.com/google/yapf), we also have a stylefile `yapf.rc` for this tool in
|
|
|
our sources.
|
|
|
|
|
|
For friends of `vim`, some settings:
|
|
|
|
|
|
Plugin 'scrooloose/syntastic'
|
|
|
au FileType python setl colorcolumn=120 list et
|
|
|
let g:syntastic_always_populate_loc_list = 1
|
|
|
let g:syntastic_auto_loc_list = 1
|
|
|
let g:syntastic_check_on_open = 1
|
|
|
let g:syntastic_check_on_wq = 1
|
|
|
let g:syntastic_python_checkers = ["pylint"]
|
|
|
let g:syntastic_enable_balloons = 1
|
|
|
let g:syntastic_python_pylint_args = '--rcfile=/home/daniels/cmess/python/pylint.rc'
|
|
|
|
|
|
If you have [pylint](https://www.pylint.org/) installed then you can use the target make pymess-lint
|
|
|
to check the sources codes against our standards.
|
|
|
|
|
|
![Auswahl_001](/uploads/cc00cf128bd2f26d3595c03029533c5b/Auswahl_001.png)
|
|
|
|
|
|
# Avod wild card imports
|
|
|
Example:
|
|
|
```python
|
|
|
from pymess import *
|
|
|
from scipy import *
|
|
|
from numpy import *
|
|
|
|
|
|
m = mmread("mymatrix.mtx")
|
|
|
# Which module import imports mmread?
|
|
|
```
|
|
|
It is not clear if `mmread` comes from `scipy`, `pymess` or `numpy`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|