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.
To download the code in this course, click the link below:
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.