Track
Python
Review readable functions, data shapes, exceptions, typing, testability, and async boundaries.
- 01
Naming and readability
Use names and small functions that explain intent without forcing reviewers to decode abbreviations.
namingreadabilityfunctions - 02
Truthy, falsy, and None checks
Distinguish missing values from valid falsy values such as empty strings, zero, and empty collections.
noneconditionalstruthiness - 03
Mutable default arguments
Avoid shared mutable defaults by creating fresh lists, dicts, or sets inside the function.
defaultsmutationstate - 04
List and dict comprehensions
Use comprehensions for clear transformations, but switch to loops when branching becomes the main story.
comprehensionscollectionsreadability - 05
Exception boundaries
Catch specific exceptions at the boundary and preserve the original failure with exception chaining.
exceptionserrorsboundaries - 06
Context managers for files
Use context managers so file handles and other resources close even when work fails.
filescontext managersresources - 07
Dataclasses for data shapes
Use dataclasses for stable internal data shapes instead of loose dictionaries with repeated string keys.
dataclassesdatamodels - 08
Type hints at boundaries
Add type hints where data enters or leaves a module so assumptions are visible to tools and reviewers.
typingboundariesinterfaces - 09
Dependency injection for testability
Pass collaborators into functions or classes so behavior can be tested without patching global modules.
testingdependenciesdesign - 10
Async and await boundaries
Await asynchronous work and gather independent calls intentionally so coroutines do not leak out unfinished.
asyncawaitconcurrency