Contribute Media
A thank you to everyone who makes this possible: Read More

Decorators From Basics to Class Decorators to Decorator Libraries (#138)


Decorators from Basics to Class Decorators to Decorator Libraries

Presented by Charles Merriam

Decorators simplify design and improve readability and reliability. This tutorial starts from the beginning with basic decorators, showing how simple tasks like restricting administration functions are clearer and more readable with decorators, and exactly how the decorators work. A simple library of decorators for tracing, logging, and caching results is presented. This leads into writing your own decorators and parameterized decorators either from scratch or by using libraries like Simionato's Decorator Decorator and "@call_before(fn)". Finally, using Python 3.x class decorators in place of metaclasses for most common dictionary modifications is covered.

[VIDEO HAS ISSUES: Missing about 1 minute at start, because of technical problems.]


Improve this page