Track 12 · Lesson 8 of 12
Type hints in depth
Describe data precisely with modern type hints — unions, None, nested collections, Callable, TypedDict, Protocol and generics — and know what hints do and don't do at runtime.
You will be able to
- Annotate functions with unions, X | None, nested collection types and Callable
- Describe dictionary records with TypedDict and duck-typed interfaces with Protocol
- Write generic functions and classes with the PEP 695 [T] syntax
- Explain that hints are not checked when the program runs, and validate untrusted input yourself
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.