Type hints may be built-in classes (including those defined in standard library or third-party extension modules), abstract base classes, types available in the types module, and user-defined classes (including those defined in the standard library or third-party modules).
PEP 3107 – van Rossum, Lehtosalo & Langa
I’ve never written type hints for any of my projects. I’ve read lots of code with type hints. They are typically found in larger code bases and offer perks like text editor integration. There’s something I love about a plain, easy typeless Python function. However, type hints and annotations are another tool in your bag for your codebase. Here are some key notes, assisted with research from Bing and PEP 3107 :
- began in Python 3.5
- see PEP 3107, co-authored by the creator of Python, Guido van Rossum
- usable by third party tools
- type hints performed using type annotations
