All about one of Python's most powerful tools
One of the most powerful and advanced techniques that Python offers is known as a "decorator." Simply put, a decorator allows you to trap functions and classes when they are defined, and again when they are run, and do .... well, whatever you want with them.
Decorators are hard for many people to understand — what they do, when we would want to use them, and then how to go about doing so. In this class, recorded from an online session in July 2017, we do a deep dive into Python decorators, covering such topics as:
- Built-in decorators (property, staticmethod, classmethod)
- The idea behind decorating
- Classes as decorators
- Functions as decorators
- Decorating methods
- Decorators that take arguments
- Uses for decorators
- Tips and tricks
Note: This is a recording from an online course that I gave. A more expanded version of this course, re-recorded and divided into sections for offline use, will be available in the coming months. If you purchase this course, you will get access to that one for free.
This course includes not only the video, but also solutions to the (many) exercises, and the PDFs of slides that I have prepared for this course.