Learn how to use decorators to augment your functions and classes.
Decorators are everywhere in Python. From Flask routes to to dataclasses — decorators pop up all over in Python.
Decorators use the @ syntax to augment the behavior of functions and classes. They rely on the fact that Python's functions are first-class objects that can be passed into other functions and dynamically defined within other functions.
Learn more: Python Morsels Glossary • Official Python Glossary
Join our decorators course with over a dozen hands-on exercises and short easy-to-understand videos.
Explore the Decorators Course →Want another perspective? Here are some of our favorite long-form conference talks on decorators.
💡 Tip: Watch these after taking our our decorators course for optimal learning efficiency!
Decorator fundamentals start with functions. Functions are more flexible and powerful than they appear.
You'll build your own decorators from scratch to truly understand how decorators work.
We'll practice logging, measuring performance, caching, and more.
We'll make both function decorators and class decorators and we'll look at odd decorator edge cases.
Importantly, we'll learn about how to make sure your function and class decorators are well-behaved.
You'll reinforce what you've learned through practice. Each video includes a quiz question and an exercise.