The aspect-oriented programming paradigm can support the separation of cross-cutting concerns such as logging, caching, or checking of permissions. This can improve code modularity and maintainability. Python offers decorator to implement re-usable code for cross-cutting task.

This tutorial is an in-depth introduction to decorators. It covers the usage of decorators and how to implement simple and more advanced decorators. Use cases demonstrate how to work with decorators. In addition to showing how functions can use closures to create decorators, the tutorial introduces callable class instance as alternative. Class decorators can solve problems that use be to be tasks for metaclasses. The tutorial provides uses cases for class decorators.

While the focus is on best practices and practical applications, the tutorial also provides deeper insight into how Python works behind the scene. After the tutorial participants will feel comfortable with functions that take functions and return new functions.

Mike Müller

Affiliation: Python Academy GmbH & Co. KG

I've been a Python user since 1999, teaching Python professionally since 2004. I am also active in the community organizing Python conferences such as PyCon DE, EuroSciPy, and BarCamps. I am a PSF Fellow and chair of the German Python Software Verband.

visit the speaker at: Homepage