In short, a decorator pattern wraps an object and dynamically adds some functionality to it. This is one of the roots of the confusion surrounding decorators in python, because they have the same name, can be used to implement the same idea, but can do a lot more.

Decorator features in python

Let's look at some characteristics of decorators in Python

Decorator is the syntax feature, that can be applied to

The decorator can do anything with a decorated object, for example

add new behaviour (classical decorator pattern from GoF book)

replace decorated object with something else

change interface of decorated class or function (can be used as implementation of Adapter pattern)