A decorator is a function that takes a function or method as its sole argument and returns a new function or method that incorporates the decorated function or method with some additional functionality added. We have already made use of some predefined decorators, for example,
@classmethod. In this section we will learn how to create our own function decorators, and later in this short cut we will see how to create class decorators.
For our first decorator example, let us suppose that we have many functions that perform calculations, and that some of these must ...