This guide documents development conventions for Python at source{d}. Check general conventions for language-independent conventions that are also applicable for Python projects.
- Contributing to existing projects - do not change the style.
- PEP8 with 99 char line length limit.
- Class methods order: first public, then protected (
_), then private (__) - Use double quotes
". When a string contains single or double quote characters, however, use the other one to avoid backslashes in the string. - Favor
%toformat(). Althoughformat()is generally considered as a replacement, it is much slower and the other languages stick to theprintfsyntax. As with the double quotes, we therefore reduce the friction with Go switches. - Do not use single letter argument names; use X and Y only in sklearn context.
- Use Sphinx style for docstrings.
- Format of TODO and FIXME:
# TODO(mygithubuser): blah-blah-blah.
- Use standard argparse.