• typo
  • annotations
  • generic

As of Python 3.9 / PEP 585 the builtin containers are type hint generics. For example, list[str] is the annotation for “a list of strings”.

Typos mixing up idexing [] and calling () no longer fail, but create a types.GenericAlias. This leads to obscure error Type Error: “'types.GenericAlias' object is not ...” when the result is used.

>>> values = list[range(5)]  # typo is here
>>> for value in values:     # error occurs here
...     print(value)