You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New Syntax: type alias / type A[T] = X (Python 3.12) #852
@lieryan The patchedast part is done and released in 1.15.0. #854 added TypeAlias, and #845 added type parameters on aliases. get_patched_ast() handles both type Alias = int and type ListOf[T] = list[T], and write_ast() reproduces the source exactly.
What's left is name resolution. Rename refuses Alias with "should be performed on resolvable python identifiers". That's #862, which PR #874 fixes. #874 deliberately leaves out renaming the alias's own type parameter, because that needs a scope for the alias. Should that become a separate sub-issue here, so this can be closed once #874 is merged?
Activity
[-]New Syntax: `type` keyword[/-][+]New Syntax: `type` keyword (Python 3.12)[/+][-]New Syntax: `type` keyword (Python 3.12)[/-][+]New Syntax: type alias / `type A[T] = X` (Python 3.12)[/+]mcepl commentedon Nov 2, 2026
@lieryan The
patchedastpart is done and released in 1.15.0. #854 addedTypeAlias, and #845 added type parameters on aliases.get_patched_ast()handles bothtype Alias = intandtype ListOf[T] = list[T], andwrite_ast()reproduces the source exactly.What's left is name resolution. Rename refuses
Aliaswith "should be performed on resolvable python identifiers". That's #862, which PR #874 fixes. #874 deliberately leaves out renaming the alias's own type parameter, because that needs a scope for the alias. Should that become a separate sub-issue here, so this can be closed once #874 is merged?