translate these ideas to code decorator-based augmentation in pure augmentation casesdecorators can often stand in for metaclasses for examplethe prior section' metaclass examplewhich adds methods to class on creationcan also be coded as class decoratorin this modedecorators roughly correspond to the __init__ method of metaclassessince the class object has already been created by the time the decorator is invoked also as for metaclassesthe original class type is retainedsince no wrapper object layer is inserted the output of the followingfile extenddeco pyis the same as that of the prior metaclass codeextend with decoratorsame as providing __init__ in metaclass def eggsfunc(obj)return obj value def hamfunc(objvalue)return value 'hamdef extender(aclass)aclass eggs eggsfunc aclass ham hamfunc return aclass @extender class client def __init__(selfvalue)self value value def spam(self)return self value manages classnot instance equiv to metaclass __init__ client extender(client rebound at end of class stmt @extender class client value 'ni? client ('ni!'print( spam()print( eggs()print( ham('bacon') is client instance client (print( eggs()print( ham('bacon')in other wordsat least in certain casesdecorators can manage classes as easily as metaclasses the converse isn' quite so straightforwardthoughmetaclasses can be used to manage instancesbut only with certain amount of extra magic the next section demonstrates exampleadding methods to classes