Type hinting in Python is a very useful feature that you can happily live without. Type hints don’t make you capable of writing any code you can’t write without using type hints. Instead, using type hints makes it easier for you to reason about code, find subtle bugs, and maintain a clean architecture.
In this course, you learned how type hinting works in Python, and how gradual typing makes type checks in Python more flexible than in many other languages. You’ve seen some of the pros and cons of using type hints, and how they can be added to code using annotations or type comments. Finally, you saw many of the different types that Python supports, as well as how to perform static type checking.
There are many resources to help you learn more about static type checking in Python. PEP 483 and PEP 484 give a lot of background on how type checking is implemented in Python. The Mypy documentation has a great reference section detailing all the different types available. You might also want to check out How to Use Type Hints for Multiple Return Types in Python.
To download the code in this course, click the link below:
aaliquegrahame on Nov. 3, 2019
Great info! Not sure if I missed this but hints would work for user defined types as well right?