built-in generic types

Container types in type hints written with their item types in square brackets, such as list[str] or dict[str, int].

In more detail

Since Python 3.9 the built-in names list, dict, tuple and set can be subscripted this way directly in hints. They describe what the container holds; nothing is checked at run time.

Related terms

Taught in

References