-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
coreRelated to core functionalityRelated to core functionalitypython312Related to Python 3.12Related to Python 3.12
Description
Summary
PEP 695 adds new syntax for type parameters and generics. A few examples:
class ClassA[T: str]:
def method1(self) -> T:
...
type ListOrSet[T] = list[T] | set[T]
There are a few pieces of work involved in this:
- Adding these elements to the AST.
- Adding these elements to the parser (especially the
type
soft keyword). - Adding these elements to the visitor, and to any rules that do custom visiting.
- Adding these elements to our semantic model (need to look into how scoping and resolution works).
This will be Ruff's first time undergoing a significant grammar and syntax change (apart from adding structural pattern matching), so it's a great opportunity to set the project's standards for keeping up with Python's evolution.
Specifically, the final Python 3.12 release is expected on 2023-10-02. We should aim to support PEP 695 by that date at the latest.
edgarrmondragon, q0w, janosh and T-256scastlara, q0w and neutrinocerosdhruvmanila, evanrittenhouse and q0w
Metadata
Metadata
Assignees
Labels
coreRelated to core functionalityRelated to core functionalitypython312Related to Python 3.12Related to Python 3.12