Python 3.12+ Feature Usage¶
The project targets Python 3.13+ and SHOULD leverage 3.12+ features where they improve clarity or safety:
- PEP 695 generics:
def func[T](x: T) -> T:instead ofTypeVar typestatement:type JsonResult = dict[str, str]instead ofTypeAliasoverridedecorator (PEP 698) for method overrides;Selffor factory return typesasyncio.TaskGroupfor structured concurrency;asyncio.timeout()overwait_for()match/caseoverif/eliffor variant dispatch (events, tool results)- Walrus operator
:=for assignment in conditions:if (n := len(data)) > 10: itertools.batched()(3.12+) for chunking;functools.cache/cached_propertyfor memoization
Deprecated patterns
typing.TypeVar, typing.TypeAlias, asyncio.wait_for() — use the modern alternatives above.