|
|
accumulate and pairwise: max drawdown in one pass
|
Easy
|
Primitives
|
|
|
|
aclosing: release the connection on break, error and cancellation
|
Hard
|
Primitives
|
|
|
|
batched: page a stream, and validate before you yield
|
Easy
|
Primitives
|
|
|
|
cached_property: compute once, release with the instance, invalidate on demand
|
Medium
|
Primitives
|
|
|
|
cache: memoised edit distance behind a validated wrapper
|
Medium
|
Primitives
|
|
|
|
ChainMap: resolve config and keep the provenance
|
Medium
|
Primitives
|
|
|
|
contextmanager: temporarily patch an attribute, and put it back
|
Medium
|
Primitives
|
|
|
|
Counter: top n-grams with deterministic ties
|
Easy
|
Primitives
|
|
|
|
Dataclasses: slots, frozen, order
|
Easy
|
Primitives
|
|
|
|
@dataclass is a code generator: what it emits
|
Easy
|
Primitives
|
|
|
|
datetime: reject naive input, and find the next local wall clock
|
Hard
|
Primitives
|
|
|
|
defaultdict: group rows, hand back a plain dict
|
Easy
|
Primitives
|
|
|
|
deque: rolling median and the maxlen narrowing
|
Medium
|
Primitives
|
|
|
|
ExitStack: all-or-nothing acquisition of N resources
|
Hard
|
Primitives
|
|
|
|
field(): the seven knobs that change generated behaviour
|
Medium
|
Primitives
|
|
|
|
Flag: a permission mask that prints, iterates and refuses bad bits
|
Medium
|
Primitives
|
|
|
|
groupby: summarise rows without losing half of them
|
Medium
|
Primitives
|
|
|
|
heapq: a priority queue that is FIFO among equal priorities
|
Medium
|
Primitives
|
|
|
|
itertools: take n across chunks without over-consuming
|
Easy
|
Primitives
|
|
|
|
Lazy record batches: what laziness moves
|
Medium
|
Primitives
|
|
|
|
Logging in libraries: the hierarchy, the effective level, and whose configuration it is
|
Medium
|
Framework
|
|
|
|
lru_cache on a method: fix the unbounded instance leak
|
Hard
|
Primitives
|
|
|
|
NamedTuple: when a record should be a tuple
|
Medium
|
Primitives
|
|
|
|
nullcontext and suppress: use the stream you were given, close only what you opened
|
Easy
|
Primitives
|
|
|
|
partial: a signature-preserving retrier, and the 3.14 descriptor change
|
Medium
|
Primitives
|
|
|
|
pathlib: safe_join, or how to not serve /etc/passwd
|
Easy
|
Primitives
|
|
|
|
Self-documenting f-strings: f"{x=}"
|
Easy
|
Primitives
|
|
|
|
singledispatch: a JSON encoder callers can extend from outside
|
Hard
|
Primitives
|
|
|
|
StrEnum: migrate a module of string constants without breaking callers
|
Medium
|
Primitives
|
|
|
|
Structured logging: events, not sentences
|
Hard
|
Framework
|
|
|
|
The f-string format specification mini-language
|
Easy
|
Primitives
|
|
|
|
The mutable-default trap — and why the guard is weaker than you think
|
Easy
|
Primitives
|
|
|
|
tomllib: turn dict[str, Any] into a typed config, or a named error
|
Medium
|
Primitives
|
|
|
|
total_ordering: SemVer, where pre-release sorts before release
|
Medium
|
Primitives
|
|
|
|
walk: prune the subtree, not just the results
|
Medium
|
Primitives
|
|
|
|
What Actually Crosses a Process Boundary
|
Medium
|
Framework
|
|
|
|
What goes on sys.path first
|
Medium
|
Framework
|
|