styleguide
pythoncode-stylegooglesoftware-engineeringbest-practices
Abstraction: Google's authoritative Python coding standards and best practices
Key points:
- 80-character max line length; use implicit line continuation with parentheses, not backslashes; 4-space indentation, no tabs
- Type annotations strongly encouraged; run pytype at build time; always annotate public APIs
- Avoid mutable global state; module-level constants permitted and encouraged (ALL_CAPS naming)
- Docstrings mandatory for non-trivial functions; use
"""format with Args/Returns/Raises sections; class docstrings document public attributes - Use pylint for linting; suppress specific warnings with symbolic names (not deprecated disable-msg); do not use catch-all
except:clauses - Prefer f-strings or
%formatting over+concatenation; avoid string accumulation in loops (use list + join)
Connections: Google · Python · Code Style · Software Engineering