Table of Contents
- 1 Background
- 2 Python Language Rules
- 2.1 Lint
- 2.2 Imports
- 2.3 Packages
- 2.4 Exceptions
- 2.5 Global variables
- 2.6 Nested/Local/Inner Classes and Functions
- 2.7 Comprehensions & Generator Expressions
- 2.8 Default Iterators and Operators
- 2.9 Generators
- 2.10 Lambda Functions
- 2.11 Conditional Expressions
- 2.12 Default Argument Values
- 2.13 Properties
- 2.14 True/False Evaluations
- 2.16 Lexical Scoping
- 2.17 Function and Method Decorators
- 2.18 Threading
- 2.19 Power Features
- 2.20 Modern Python: from __future__ imports
- 2.21 Type Annotated Code
- 3 Python Style Rules
- 3.1 Semicolons
- 3.2 Line length
- 3.3 Parentheses
- 3.4 Indentation
- 3.5 Blank Lines
- 3.6 Whitespace
- 3.7 Shebang Line
- 3.8 Comments and Docstrings
- 3.10 Strings
- 3.11 Files, Sockets, and similar Stateful Resources
- 3.12 TODO Comments
- 3.13 Imports formatting
- 3.14 Statements
- 3.15 Accessors
- 3.16 Naming
- 3.17 Main
- 3.18 Function length
- 3.19 Type Annotations
- 3.19.1 General Rules
- 3.19.2 Line Breaking
- 3.19.3 Forward Declarations
- 3.19.4 Default Values
- 3.19.5 NoneType
- 3.19.6 Type Aliases
- 3.19.7 Ignoring Types
- 3.19.8 Typing Variables
- 3.19.9 Tuples vs Lists
- 3.19.10 TypeVars
- 3.19.11 String types
- 3.19.12 Imports For Typing
- 3.19.13 Conditional Imports
- 3.19.14 Circular Dependencies
- 3.19.15 Generics
- 3.19.16 Build Dependencies
- 4 Parting Words