Overview
Explore the importance of PEP 544 and Protocols in Python's static type system in this 28-minute PyCon US talk by Luciano Ramalho. Dive into the concept of structural subtyping and static duck typing, understanding how typing.Protocol enhances the expressiveness of type hints. Learn how this feature enables correct annotation of Pythonic APIs and standard library functions. Examine real-world examples from the typeshed project, progressing from basic concepts to more complex applications. Gain insights into static vs. dynamic typing, annotations, numeric unions, restricted type variables, and syntax. Discover how Protocols serve as the keystone for Python type hints, improving code verification by static type checkers and IDEs.
Syllabus
Introduction
Static vs Dynamic typing
The problem
Annotations
Number ABC
Numeric Union
Restricted Type var
Syntax
Solution
Taught by
PyCon US