Python Decorators Inception

Python decorators provide elegant power. When you read about them, they may seem difficult: functions that wrap functions... functions that create functions that wrap functions... decorators to decorate your decorators! This talk will walk you through the levels of decorators and provide clear examples. Learn to write functions that create new functions, and how functions can "close over" data. Learn how to use decorators to add logging or other side-effects to functions. Learn how to make decorators optional, enabled or disabled at run time and costing nothing when disabled. Gain a more complete understanding of what happens when you import a module, and how to use decorators to do things when your code is imported. Write your own decorators. And of course, learn how to use a decorator to decorate your decorators.
Length: 46:21
Views 140 Likes: 0
abstract
Recorded on 2016-04-23 at Linuxfest Northwest
Look for other videos at Linuxfest Northwest.
Tweet this video