an attribute assigned to an instance of that class is accessed they provide general way to insert arbitrary code that is run implicitly when specific attribute is accessed as part of the normal attribute lookup procedure function and class decorators as we saw in the special @callable syntax for decorators allows us to add logic to be automatically run when function is called or class instance is created this wrapper logic can trace or time callsvalidate argumentsmanage all instances of classaugment instances with extra behavior such as attribute fetch validationand more decorator syntax inserts name-rebinding logic to be run at the end of function and class definition statements--decorated function and class names may be rebound to either augmented original objectsor to object proxies that intercept later calls metaclasses the last topic of magic introduced in which we take up here as mentioned in this introductionmetaclasses are continuation of this story --they allow us to insert logic to be run automatically at the end of class statementwhen class object is being created though strongly reminiscent of class decoratorsthe metaclass mechanism doesn' rebind the class name to decorator callable' resultbut rather routes creation of the class itself to specialized logic language of hooks in other wordsmetaclasses are ultimately just another way to define automatically run code with the tools listed in the prior sectionpython provides ways for us to interject logic in variety of contexts--at operator evaluationattribute accessfunction callsclass instance creationand now class object creation it' language with hooks galore -- feature open to abuse like any otherbut one that also offers the flexibility that some programmers desireand that some programs may require as we've also seenmany of these advanced python tools have intersecting roles for exampleattributes can often be managed with propertiesdescriptorsor attribute interception methods as we'll see in this class decorators and metaclasses can often be used interchangeably as well by way of previewalthough class decorators are often used to manage instancesthey can also be used to manage classes insteadmuch like metaclasses similarlywhile metaclasses are designed to augment class constructionthey can also insert proxies to manage instances insteadmuch like class decorators in factthe main functional difference between these two tools is simply their place in the timing of class creation as we saw in the prior class decorators run after the decorated class has already been created thusthey are often used to add logic to metaclasses