Let's write some decorators!
- Track:
- Python Core, Internals, Extensions
- Type:
- Tutorial
- Level:
- intermediate
- Duration:
- 180 minutes
Abstract
Decorators are one of Python's most powerful features. But for many developers, they remain somewhat mysterious and intimidating, because they combine a number of complex ideas -- among them, functions as objects, and nested function definitions. In this tutorial, you'll learn what decorators are, how they work, how to write them, and when you should use them. Along the way, you'll write a bunch of decorators that will demonstrate their power and practical use cases.
This is a highly interactive, learn-by-doing tutorial in which you'll be actively encouraged to ask questions, challenge the instructor, and share your code (including code that doesn't work), to maximize everyone's learning.