typing.TypeVar
#Python_typing
https://docs.python.org/ja/3/library/typing.html#typing.TypeVar
型変数
code:宣言する例.py
T = TypeVar('T') # Can be anything
S = TypeVar('S', bound=str) # Can be any subtype of str
A = TypeVar('A', str, bytes) # Must be exactly str or bytes
Type variables exist primarily for the benefit of static type checkers.
They serve as the parameters for generic types as well as for generic function definitions
ジェネリクスと関連する(『ロバストPython』5.4 新しいコレクション型の作成が分かりやすい(5.4.1))
PEP 695 – Type Parameter SyntaxによりPython 3.12以降は[]で書けるようになった(出番が減っていくのでは)