Overview
Explore techniques and best practices for enhancing Python decorators with type annotations in this 21-minute PyCon US talk. Learn how to leverage type hints to improve decorator clarity, catch errors early, and reduce debugging time. Discover practical implementations using advanced typing features like TypeVarTuple, Protocol, ParamSpec, Concatenate, and Type Parameter Syntax. Gain insights into making decorators more robust and user-friendly, addressing common questions about argument passing, function targeting, and return type changes. Apply these strategies to create well-typed decorators that enhance code quality and guide developers towards correct usage in their projects.
Syllabus
Talks - Koudai Aono: Enhancing Decorators with Type Annotations: Techniques and Best Practices
Taught by
PyCon US