Python decorators (live edition) by Reuven M. Lerner

Python decorators (live edition)

All about one of Python's most powerful tools

Overview

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.

What's included?

Video Icon 1 video File Icon 3 files

Contents

Video
Python decorators
(4h 01m 07s)
Slide PDFs
Basic decorators
49 KB
Advanced decorators
65.5 KB
Solutions to exercises
decorators.ipynb
67.9 KB

Because better developers have better careers

Have a more satisfying, successful, and lucrative career, by becoming more fluent in Python, Git, and related technologies. 

FAQ