PEP 849: More Expressive Type Expressions
Currently, the Python interpreter allows any expression to be used as an annotation. But their most popular usage, type annotations, are restricted to only a small subset of possible expressions. This is because type ann...
Verified State Diff
Impact & Verification Analysis
Developers, software engineers, and active Python users.
Enhances platform capabilities, developer velocity, and product capabilities.
Full Fact Overview
Currently, the Python interpreter allows any expression to be used as an annotation. But their most popular usage, type annotations, are restricted to only a small subset of possible expressions. This is because type annotations need to be introspectable at runtime and many valid expressions produce values where that is not possible. This greatly limits which expressions can be assigned a meaning within the typing spec and limits the expressiveness and ease of use of type annotations.