All About Decorators

Create your own decorators in Python

Learn how to use decorators to augment your functions and classes.

💡

Why Learn Decorators?

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.

🎯 Decorator Fundamentals

🎯 Ready to Get Practice With Decorators?

Join our decorators course with over a dozen hands-on exercises and short easy-to-understand videos.

Explore the Decorators Course →

🎁 Additional Learning Resources

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!

What's in the Decorators Course?

🎯

Functions First

Decorator fundamentals start with functions. Functions are more flexible and powerful than they appear.

🛠️

Create Custom Decorators

You'll build your own decorators from scratch to truly understand how decorators work.

🔧

Real-World Applications

We'll practice logging, measuring performance, caching, and more.

Advanced Patterns

We'll make both function decorators and class decorators and we'll look at odd decorator edge cases.

💡

Best Practices

Importantly, we'll learn about how to make sure your function and class decorators are well-behaved.

🎓

Hands-On Practice

You'll reinforce what you've learned through practice. Each video includes a quiz question and an exercise.