Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to hundreds of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Python Type Checking: Summary

Give Feedback

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:


Sample Code (.zip)

8.3 KB

aaliquegrahame on Nov. 3, 2019

Great info! Not sure if I missed this but hints would work for user defined types as well right?

Geir Arne Hjelle RP Team on Nov. 3, 2019

Yes, type hints work great for user defined types as well.

I don’t think it’s covered in the videos, but you can find some information about using your own classes as types in the article the videos are based on (see the Supporting Material link under the video):

km on Jan. 8, 2020

Another wonderful learning !

Become a Member to join the conversation.