News for hackers. Stuff that matters.
Re:Why Today's Python Developers Are Embracing Type Hints by dragonwriter on Monday September 29, 2025 @01:04AM (#45410477)
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.

There are no comments on this comment yet.