tree-sitter / tree-sitter-python

Python grammar for tree-sitter
MIT License
360 stars 132 forks source link

3.12 "`type`" soft keyword (PEP 0695) #236

Closed johannesrld closed 1 year ago

johannesrld commented 1 year ago

(Per pep0695)

Python 3.12 (Upcoming) introduced a new soft keyword called type which allows you to do something like this:

# A non-generic type alias
type IntOrStr = int | str
# A generic type alias
type ListOrSet[T] = list[T] | set[T]

(It also introduces generics syntax for things like functions and classes but thats probably better left to another issue)

amaanq commented 1 year ago

Added on master