When the decorated function is called, the focus of Python is redirected to the decorating function. The decorator becomes a wrapper around the function. So, the name of the function that is called remains as the identity of the function, even when it is referenced by the decorating function.
Decorators are thus a very elegant way of combining methods and functions without having to re-arrange someone else's code.
>>> a.attribute 'I live to decorate a' >>> b.mantra 'My existence is as an ornament for b' >>> c.attribute 'I live to decorate c' >>> c.mantra 'My existence is as an ornament for c'
In addition to the information presented here, on the Python Software Foundation's website you can find the proposal that lead to decorators, PEP 318, and the introductory discussion about them that accompanied Python 2.4.