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

Charles Merriam
30min ◊ Beginner
Saturday 10:25am, Centennial II
categories: decorators

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.


files Files:
slides
filesizeuploadedcomment
dectalk.pdf 264.7 KB Sat, Feb. 20th, 8:18 a.m. Slides of the presentation
sources.txt 367 bytes Mon, March 1st, 1:20 p.m. Sources for dectools repository, location, updated slides, etc.


video video:


  
# Permalink