Typing

Self type in Python

Use Python's Self type from PEP 673 to annotate methods returning class instances, eliminating complex forward references and TypeVars.

Why 'NoReturn' type exists in Python

Use Python's NoReturn type to annotate functions that never return normally, helping type checkers understand exception-raising and infinite loop code.

Static typing Python decorators

Type Python decorators accurately using ParamSpec and Concatenate to preserve wrapped function signatures and enable proper static analysis.

Structural subtyping in Python

Implement Go-style structural subtyping in Python with Protocol for duck typing and interface-based APIs without inheritance dependencies.