Get started with Python type hints
Python is best thought of as a dynamic but strongly typed language. Types aren’t associated with the names of things but with the things themselves.
This makes Python flexible and convenient for developers because you don’t have to rigorously define and track variable types if you’re just throwing together a quick-and-dirty script. But for bigger projects, especially libraries used by third parties, it helps to know which object types are associated with which variables.
For some time now, Python has had the ability to “annotate” names with type information, in one form or another. With Python 3.5, type hints officially became part of the language (PEP 484). Using a linter or code-checking tool, developers can check the consistency of variables and their types across a codebase, and perform static analysis of code that would previously have been difficult or impossible. All this is done ahead of time, before the code runs.
Author: . [Source Link (*), InfoWorld]