We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

A Taxonomy of Decorators: A-E

Formal Metadata

Title
A Taxonomy of Decorators: A-E
Title of Series
Number of Parts
132
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
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.