Generics — typing documentation
| Generics¶. You may have seen type hints like list[str] or dict[str, int] in Python code.Variables should not have a type variable in their type unless the type variable is bound by a containing generic class, generic function or generic alias. Generic methods and generic self¶.