Skip to content

Generics practice problems in Python

Difficulty:
Category:
Tag:

Showing 25 of 25

Status Title Difficulty
Accept broad, return narrow: group_by and merge_counts Medium
A Fetcher Protocol three implementations can satisfy Medium
A generic Result[T, E] Medium
BoundedBuffer: a blocking queue from one Condition Medium
Bounds versus constraints: clamp and dedupe Hard
Capstone: a typed, cancellable, observable worker pool Hard
Exception chaining: raise ... from Medium
fetch_all: structured fan-out with TaskGroup Medium
Free-Threading: Writing Code That Survives It Hard
Generic dataclasses, Self, and the covariance question Hard
Generic partition and chunk Medium
map_with_failures: partial success on a thread pool Medium
Order-preserving dedupe and a real sliding window Easy
@overload: one implementation, several honest signatures Hard
Placement 1/6: generics and variance Medium
Process Is a Typing Black Hole — Prefer Executors Easy
run_sync: the sync boundary a library should expose Easy
run_workers: results, errors and a join deadline Medium
Self-types, and restricting a method to one parameterisation Medium
Subinterpreters: PEP 734 and the Typed Queue Medium
TypeVarTuple: generics over an arbitrary number of types Hard
Typing the error path: Result, attempt and Never Hard
Variance in generic protocols Hard
with_cleanup: bounded cleanup on every exit path Hard
Writing generic code over dataclasses under --strict Hard