Python 3.9 introduced built-in generic types such as list[T]
, dict[T]
, set[T]
to make type hints more
concise and easier to read. These built-in types have the same functionality as their counterparts in the typing
module, but are more
readable and idiomatic.
Using types such as typing.List
is confusing in the presence of the already existing built-in types. This can also create
inconsistencies when different parts of the codebase use different syntaxes for the same type.