After several rounds of debate on typing-sig, I'd like to request feedback
on PEP 695: https://peps.python.org/pep-0695/
I am sponsoring this PEP, which was written by Eric Traut. The PEP attempts
to solve the problem that defining generic classes, functions and type
aliases currently is lacking dedicated syntax, instead using the cumbersome
`T = TypeVar("T", ...)` notation to create global variables that serve as
type variables.
As a personal historical note, I should mention that over 22 years ago I
already pondered type parameters. In an old document that I saved I found
the following code snippet:
```
def f<T> (a: T) -> T: ...
```
which is eerily close to the proposal in this PEP, except that the PEP uses
square brackets:
```
def f[T](a: T) -> T: ...
```
It's been a long and circuitous road!
I am not quoting the entire PEP here, please follow the link:
https://peps.python.org/pep-0695/
--
--Guido van Rossum (python.org/~guido)
on PEP 695: https://peps.python.org/pep-0695/
I am sponsoring this PEP, which was written by Eric Traut. The PEP attempts
to solve the problem that defining generic classes, functions and type
aliases currently is lacking dedicated syntax, instead using the cumbersome
`T = TypeVar("T", ...)` notation to create global variables that serve as
type variables.
As a personal historical note, I should mention that over 22 years ago I
already pondered type parameters. In an old document that I saved I found
the following code snippet:
```
def f<T> (a: T) -> T: ...
```
which is eerily close to the proposal in this PEP, except that the PEP uses
square brackets:
```
def f[T](a: T) -> T: ...
```
It's been a long and circuitous road!
I am not quoting the entire PEP here, please follow the link:
https://peps.python.org/pep-0695/
--
--Guido van Rossum (python.org/~guido)