Andy Fundinger - A Taxonomy of Decorators: A E
Channel: EuroPython Conference
Date: 2018-09-06

A Taxonomy of Decorators: A-E
[EuroPython 2018 - Talk - 2018-07-27 - Moorfoot]
[Edinburgh, UK]

By Andy Fundinger

This talk will briefly go over the various decorator syntaxes before breaking up the common usages of decorators into 5 categories. Effectively, these are design patterns for decorators. The usages to be considered are:


A - Argument Changing Decorators -- Decorators that change a function's arguments, including changing its signature
B - Binding Decorators -- Decorators that implement the Descriptor Protocol, such as the builtins: @property, @classmethod, and @staticmethod
C - Control Flow Decorators -- Decorators that change when or whether the function will be called, such as @retry or @lrucache
D - Descriptive Decorators -- Decorators that do not change the function, but create a reference to it elsewhere, like pytest.mark and flask.app.route
E - Execution Decorators -- Decorators that retrieve source code and/or AST and alter it.




License: This video is licensed under the CC BY-NC-SA 3.0 license: https://creativecommons.org/licenses/by-nc-sa/3.0/
Please see our speaker release agreement for details: https://ep2018.europython.eu/en/speaker-release-agreement/