Unfortunately, you cannot reuse type variables defined with PEP 695 syntax.

The type variable must have the correct bound to parametrize the superclass (in other words, bounds and constraints can't be inferred or magically "pushed down" from the superclass, that has soundness problems if you consider multiple inheritance). So, you need some way to spell "reuse type variable with these {constraints,bound,default}"... And as you noted in you question, typing.TypeVar is doing exactly that.

Please note that typing.TypeVar is not deprecated (only typing.TypeAlias is) - new generics syntax is just another way, not a replacement. It will likely stay alive for a very long time if not indefinitely: Eric Traut's comment on that

It’s also important to note that this PEP doesn’t deprecate the current mechanisms for defining TypeVars or generic classes, functions, and type aliases. Those mechanisms can live side by side with the new syntax. If you find that those mechanisms are more flexible for exploring extensions to the type system, PEP 695 does not prevent you from leveraging these existing mechanisms.

There are other problems with PEP 695 typevars like inability to specify variance explicitly, so some corner cases would become impossible to express if typing.TypeVar was ever deprecated.

I'm not aware of any recent proposals or discussions that would enable reusing PEP 695 type variables, and for the reasons mentioned above I doubt that will ever be possible.

Answer from STerliakov on Stack Overflow
🌐
Python
typing.python.org › en › latest › spec › generics.html
Generics — typing documentation
The introduction of explicit syntax for generic classes in Python 3.12 eliminates the need for variance to be specified for type parameters. Instead, type checkers will infer the variance of type parameters based on their usage within a class.
🌐
ArjanCodes
arjancodes.com › blog › python-generics-syntax
Python 3.12 Generics: Cleaner, Easier Type-Hinting | ArjanCodes
June 6, 2024 - The change aims to streamline type hinting, reduce the cognitive load on developers, and make type-annotated code easier to read and write. By minimizing the boilerplate code required for generics, Python 3.12 enhances the developer experience and aligns Python’s generics more closely with those found in other modern programming languages.
Discussions

Subclassing a generic class with constrained type variable in Python 3.12+ without repeating the constraints - Stack Overflow
I would like to subclass a generic class that is using a constrained type variable. This is fairly easy with pre-3.12 syntax as shown in this minimal example: from typing import Generic, TypeVar T = More on stackoverflow.com
🌐 stackoverflow.com
Generic[T] classmethod implicit type retrieval in Python 3.12 - Stack Overflow
I would like to use the new Python 3.12 generic type signature syntax to know the type of an about-to-be-instantiated class within the classmethod of that class. For example, I would like to print ... More on stackoverflow.com
🌐 stackoverflow.com
Let's talk about python 3.12's new Type Parameter Syntax.
There was probably much discussion on this placement, and there is not point discussing it now because it won't change. If you want to learn more about this, I recommend reading PEP 695 and additionally the following: https://jellezijlstra.github.io/pep695 https://github.com/python/peps/pull/3122 More on reddit.com
🌐 r/Python
43
0
January 26, 2024
Recursive Generic Type Hints (python 3.12)
type _RList[U] = list[int | _RList[U]] What's the point of U here? More on reddit.com
🌐 r/Python
9
29
April 10, 2025
🌐
Medium
medium.com › @r_bilan › generics-in-python-3-12-whats-new-in-the-syntax-and-how-to-use-it-now-1024fcdf02f8
Generics in Python 3.12: What’s New in the Syntax and How to Use It Now | by Rostyslav Bilan | Medium
October 2, 2024 - There’s no longer a need to import Generic and TypeVar, and we can directly use generics in classes and methods, making the process of working with generics significantly easier. Previously, you had to use TypeAlias from the typing module to declare a type alias: from typing import TypeAlias, TypeVar _T = TypeVar("_T") ListOrSet: TypeAlias = list[_T] | set[_T] But now, with the new syntax in Python 3.12, it can be written as:
🌐
Real Python
realpython.com › python312-typing
Python 3.12 Preview: Static Typing Improvements – Real Python
October 21, 2023 - In this tutorial, you'll preview the new static typing features in Python 3.12. You'll learn about the new syntax for type variables, making generics simpler to define. You'll also see how @override lets you model inheritance and how you use typed dictionaries to annotate variable keyword arguments.
🌐
mypy
mypy.readthedocs.io › en › latest › generics.html
Generics - mypy 1.20.0+dev.acfef9c84da69805f740e67b108910888d66f7ab documentation
There are two syntax variants for defining generic classes in Python. Python 3.12 introduced a new dedicated syntax for defining generic classes (and also functions and type aliases, which we will discuss later). The above example used the new syntax. Most examples are given using both the ...
🌐
Python documentation
docs.python.org › 3 › whatsnew › 3.12.html
What's New In Python 3.12 — Python 3.14.3 documentation
1 month ago - For example, they can be used in the type annotations for the methods of a generic class or in the class body. However, they cannot be used in the module scope after the class is defined. See Type parameter lists for a detailed description of the runtime semantics of type parameters. In order to support these scoping semantics, a new kind of scope is introduced, the annotation scope. Annotation scopes behave for the most part like function scopes, but interact differently with enclosing class scopes. In Python 3.13, annotations will also be evaluated in annotation scopes.
🌐
YouTube
youtube.com › arjancodes
Python 3.12 Generics in a Nutshell - YouTube
👷 Review code better and faster with my 3-Factor Framework: https://arjan.codes/diagnosis.Generics in Python 3.12 can transform your code by allowing classe...
Published   April 2, 2024
Views   51K
🌐
YouTube
youtube.com › arjancodes
Python 3.12 Generic Types Explained - YouTube
Check out Hostinger ➡️ https://www.hostinger.com/arjancodes ✅ Hostinger code for 10% off: ARJANCODES In this video, I’m going to explore how generic types in...
Published   November 17, 2023
Views   60K
Find elsewhere
Top answer
1 of 2
1

Unfortunately, you cannot reuse type variables defined with PEP 695 syntax.

The type variable must have the correct bound to parametrize the superclass (in other words, bounds and constraints can't be inferred or magically "pushed down" from the superclass, that has soundness problems if you consider multiple inheritance). So, you need some way to spell "reuse type variable with these {constraints,bound,default}"... And as you noted in you question, typing.TypeVar is doing exactly that.

Please note that typing.TypeVar is not deprecated (only typing.TypeAlias is) - new generics syntax is just another way, not a replacement. It will likely stay alive for a very long time if not indefinitely: Eric Traut's comment on that

It’s also important to note that this PEP doesn’t deprecate the current mechanisms for defining TypeVars or generic classes, functions, and type aliases. Those mechanisms can live side by side with the new syntax. If you find that those mechanisms are more flexible for exploring extensions to the type system, PEP 695 does not prevent you from leveraging these existing mechanisms.

There are other problems with PEP 695 typevars like inability to specify variance explicitly, so some corner cases would become impossible to express if typing.TypeVar was ever deprecated.

I'm not aware of any recent proposals or discussions that would enable reusing PEP 695 type variables, and for the reasons mentioned above I doubt that will ever be possible.

2 of 2
0

It caused by PEP 695 with the new syntax introduced with it. So there is no way to not specify T: (int, float) in Subclass

🌐
Stack Overflow
stackoverflow.com › questions › 78376096 › generict-classmethod-implicit-type-retrieval-in-python-3-12
Generic[T] classmethod implicit type retrieval in Python 3.12 - Stack Overflow
Alternatively, you can rebind the custom class method to the Generic type, so that the first argument of the class method would become the Generic type. The built-in types.MethodType does not allow __self__ to be updated for a rebind so you would have to define a Python-equivalent version:
🌐
Python documentation
docs.python.org › 3 › library › typing.html
typing — Support for type hints — Python 3.14.3 documentation
1 month ago - Changed in version 3.7: Generic no longer has a custom metaclass. Changed in version 3.12: Syntactic support for generics and type aliases is new in version 3.12.
🌐
Medium
medium.com › @arshiad3v › python-3-12-generics-in-a-nutshell-1f4906ec7dc6
Python 3.12 Generics in a Nutshell | by arshiad3v | Medium
April 2, 2024 - Here, you can use generics for varying stack sizes. Simply add your desired type (T) behind the class name. For instance: class Stack[T]: def __init__(self): self.items = [] This line of code creates a stack type that can contain items of the ...
🌐
Mypy
mypy.readthedocs.io › en › stable › generics.html
Generics - mypy 1.19.1 documentation
There are two syntax variants for defining generic classes in Python. Python 3.12 introduced a new dedicated syntax for defining generic classes (and also functions and type aliases, which we will discuss later). The above example used the new syntax. Most examples are given using both the ...
🌐
Reddit
reddit.com › r/python › recursive generic type hints (python 3.12)
r/Python on Reddit: Recursive Generic Type Hints (python 3.12)
April 10, 2025 -

TIL from this video typing a recursive flatten (by YT channel anthonywritescode) that you can now type hint recursive data & functions with generic type parameter!

# new syntax
# recursive type for nested list having elems of same type (eg. int)
type _RList[U] = list[U | _RList[U]]

def flatten[T](lst: _RList[T]) -> _RList[T]:
     """ Flatten nested list.""""
     return [
         flatten(x) if isinstance(x, list) else x
         for x in lst
     ]

NOTE: Latest mypy type checks this new syntax, but editor / IDE may not recognize it yet.

Did you all know about this? Have you found more such cool type hinting syntax in Python?

🌐
GitHub
github.com › psf › black › issues › 4355
Python 3.12 `def f[T: Generics](...)` · Issue #4355 · psf/black
May 9, 2024 - T = TypeVar("T", bound=float) def function_name( x1: datetime.datetime, x2: datetime.datetime, x3: datetime.datetime, dtype: type[T] = float ) -> None: ... Using python312 inline generics, the function is split within the generics declaration.
Author   leaver2000
🌐
Andy Pearce
andy-pearce.com › blog › posts › 2023 › Dec › whats-new-in-python-312-type-hint-improvements
What’s New in Python 3.12 - Type Hint Improvements
December 3, 2023 - As usual I’ll run over the changes in 3.12 over a few articles — in this one we’re going to take a look at a few improvements to type hints. The specific changes we’ll look at are: New syntax for defining generic classes and ...
🌐
Dasroot
dasroot.net › welcome to dasroot! tada › posts › backend › modern python 3.12 features type hints, generics, and performance
Modern Python 3.12+ Features: Type Hints, Generics, and Performance · Technical news about AI, coding and all
January 9, 2026 - Python 3.12+ introduces significant improvements in type hints, generics, and performance, enhancing code reliability and efficiency. PEP 673/674 enable precise generic type definitions with class_getitem, while variance annotations in 3.12 ...
🌐
GitHub
github.com › semgrep › semgrep › issues › 10778
Support Python 3.12 Generics · Issue #10778 · semgrep/semgrep
January 14, 2025 - Describe the bug Python 3.12 / PEP 695 brought new syntax for generic types: https://docs.python.org/3/whatsnew/3.12.html#pep-695-type-parameter-syntax Semgrep crashes on this syntax. To Reproduce ❯ cat test.py # this python script uses ...
Author   pelme