Closed
Description
there's a new type argument syntax for functions and classes
def max[T](args: Iterable[T]) -> T:
pass
class list[T]:
def __getitem__(self, index: int, /) -> T:
pass
def append(self, element: T) -> None:
pass
Resources:
- https://docs.python.org/3/reference/compound_stmts.html#generic-classes
- https://docs.python.org/3/reference/compound_stmts.html#generic-functions
- https://peps.python.org/pep-0695/
- https://docs.python.org/3/whatsnew/3.12.html#whatsnew312-pep695
- Related issue: Support type alias syntax PEP 695 (Python 3.12) #18
See also screenshot in lezer playground by @dralletje, this completely throws off the parser (it thinks it's an array, and it breaks down).
I must say I'm impressed by CM+Lezer at how very well everything recovers.
Metadata
Metadata
Assignees
Labels
No labels