timeproviding layer of logic that can manage classesor the instances created by later calls to them in shortdecorators provide way to insert automatically run code at the end of function and class definition statements--at the end of def for function decoratorsand at the end of class for class decorators such code can play variety of rolesas described in the following sections managing calls and instances in typical usethis automatically run code may be used to augment calls to functions and classes it arranges this by installing wrapper ( proxyobjects to be invoked latercall proxies function decorators install wrapper objects to intercept later function calls and process them as neededusually passing the call on to the original function to run the managed action interface proxies class decorators install wrapper objects to intercept later instance creation calls and process them as requiredusually passing the call on to the original class to create managed instance decorators achieve these effects by automatically rebinding function and class names to other callablesat the end of def and class statements when later invokedthese callables can perform tasks such as tracing and timing function callsmanaging access to class instance attributesand so on managing functions and classes although most examples in this deal with using wrappers to intercept later calls to functions and classesthis is not the only way decorators can be usedfunction managers function decorators can also be used to manage function objectsinstead of or in addition to later calls to them--to register function to an apifor instance our primary focus herethoughwill be on their more commonly used call wrapper application class managers class decorators can also be used to manage class objects directlyinstead of or in addition to instance creation calls--to augment class with new methodsfor example because this role intersects strongly with that of metaclasseswe'll see additional use cases in the next as we'll findboth tools run at the end of the class creation processbut class decorators often offer lighter-weight solution decorators