be cautious when using this method to avoid recursive loops by passing attribute accesses to superclass we met the former of these in it' available for all python versions the latter of these is available for new-style classes in xand for all (implicitly new-styleclasses in these two methods are representatives of set of attribute interception methods that also includes __setattr__ and __delattr_ because these methods have similar rolesthoughwe will generally treat them all as single topic here unlike properties and descriptorsthese methods are part of python' general operator overloading protocol--specially named methods of classinherited by subclassesand run automatically when instances are used in the implied built-in operation like all normal methods of classthey each receive first self argument when calledgiving access to any required instance state information as well as other methods of the class in which they appear the __getattr__ and __getattribute__ methods are also more generic than properties and descriptors--they can be used to intercept access to any (or even allinstance attribute fetchesnot just single specific name because of thisthese two methods are well suited to general delegation-based coding patterns--they can be used to implement wrapper ( proxyobjects that manage all attribute accesses for an embedded object by contrastwe must define one property or descriptor for every attribute we wish to intercept as we'll see aheadthis role is impaired somewhat in newstyle classes for built-in operationsbut still applies to all named methods in wrapped object' interface finallythese two methods are more narrowly focused than the alternatives we considered earlierthey intercept attribute fetches onlynot assignments to also catch attribute changes by assignmentwe must code __setattr__ method--an operator overloading method run for every attribute fetchwhich must take care to avoid recursive loops by routing attribute assignments through the instance namespace dictionary or superclass method although less commonwe can also code __delattr__ overloading method (which must avoid looping in the same wayto intercept attribute deletions by contrastproperties and descriptors catch getsetand delete operations by design most of these operator overloading methods were introduced earlier in the bookherewe'll expand on their usage and study their roles in larger contexts the basics __getattr__ and __setattr__ were introduced in and and __getattribute__ was mentioned briefly in in shortif class defines or inherits the following methodsthey will be run automatically when an instance is used in the context described by the comments to the right managed attributes