|
|
|
|
|
by dragonwriter
263 days ago
|
|
As of Python 3.12, you don’t need separately declared TypeVars with explicit variance specifications, you can use the improved generic type parameter syntax and variance inference. So, just: class Indexable[T](Protocol):
def __getitem__(self, i: int,/) -> T: ...
is enough. |
|