Overview
Learn how to leverage Python's powerful decorator syntax to enhance your code's capabilities in this comprehensive tutorial. Explore functions as first-class objects, function references, and function factories before diving into decorators. Discover how to create and apply decorators to improve code efficiency and readability. Practice with hands-on exercises covering topics such as unpacking lists, handling return values, and implementing a stack reader. By the end of this 2.5-hour session, gain the skills to confidently use and create decorators, becoming a more proficient Python programmer.
Syllabus
Introduction
What are decorators
Functions are first class objects
Function references
Function factories
Decorators
Reverse Factory
Exercise
Solution
Unpacking of Lists
Exercise 2 Return Values
Exercise 3 Stack Reader
Defining Decorators
Taught by
PyCon US