What are Python decorators?
Python decorators are special syntax of the language that allows for functions to be applied to other functions or classes. The Python Enhancement Proposal (PEP) 318 describes the syntax used by these decorators as applied to functions. The Python Enhancement Proposal (PEP) 3129 describes the syntax used by these decorators as applied to classes.
The first use of decorator notation of @function_name appeared in Python 2.2. The decorators for class methods and static functions were created so instead of using:
bar = classmethod(bar)
baz = staticmethod(baz)
This syntax allows you to call the __builtins__ functions, classmethod() and staticmethod() by using an @function_name syntax. This applied either the classmethod or staticmethod built-in functions to the function that followed the @function_name syntax.
Properties are a special case of the use of decorators. In the case of properties, the property function gets called on the function that is either a attribute setter, getter, deleter method of a class. The following two examples are equivalent
Examples of decorators
There is a repository containing numerous examples at https://wiki.python.org/moin/PythonDecoratorLibrary.