returns the actual decorator the returned decorator in turn returns the callable run later for calls to the original function namedef (arg) decorator(ab)(frebind to result of decorator' return value ( essentially calls decorator(ab)( )( decorator arguments are resolved before decoration ever occursand they are usually used to retain state information for use in later calls the decorator function in this examplefor instancemight take form like the followingdef decorator(ab)save or use ab def actualdecorator( )save or use function return callablenested defclass with __call__etc return callable return actualdecorator the outer function in this structure generally saves the decorator arguments away as state informationfor use in the actual decoratorthe callable it returnsor both this code snippet retains the state information argument in enclosing function scope referencesbut class attributes are commonly used as well in other wordsdecorator arguments often imply three levels of callablesa callable to accept decorator argumentswhich returns callable to serve as decoratorwhich returns callable to handle calls to the original function or class each of the three levels may be function or class and may retain state in the form of scopes or class attributes decorator arguments can be used to provide attribute initialization valuescall trace message labelsattribute names to be validatedand much more--any sort of configuration parameter for objects or their proxies is candidate we'll see concrete examples of decorator arguments employed later in this decorators manage functions and classestoo although much of the rest of this focuses on wrapping later calls to functions and classesit' important to remember that the decorator mechanism is more general than this--it is protocol for passing functions and classes through any callable immediately after they are created as suchit can also be used to invoke arbitrary postcreation processingdef decorator( )save or augment function or class return @decorator def () decorators decorator(