Python does not make you say what type a value has, and that freedom is a large part of its charm. In a larger program it also costs something, because a reader, or a tool, can no longer tell what a function expects without reading its body. Type hints are the answer: optional notes that state the types, which Python itself ignores, but which editors and checkers use to find mistakes before the program runs. This lesson shows how to write them, and what they do and do not do.
More lessons in Complete Python Programming