Generics — typing documentation
You may have seen type hints like list[str] or dict[str, int] in Python code. These types are interesting in that they are parametrised by other types!Using type variable bounds or values in generic aliases has the same effect as in generic classes/functions. Generic class internals¶.