in more realistic delegation scenariothis means that built-in operations like expressions no longer work the same as their traditional direct-call equivalent asymmetricallydirect calls to built-in method names still workbut equivalent expressions do not because through-type calls fail for names not at the class level and above in other wordsthis distinction arises in built-in operations onlyexplicit fetches run correctlyclass (object)data 'spamdef __getattr__(selfname)print('getattrnamereturn getattr(self datanamex ( __getitem__( getattr__getitem__ 'ptraditional mapping works but new-style' does not [ typeerror'cobject does not support indexing type(x__getitem__( attributeerrortype object 'chas no attribute '__getitem__x __add__('eggs'getattr__add__ 'spameggsditto for +instance skipped for expression only 'eggstypeerrorunsupported operand type(sfor +'cand 'strtype(x__add__( 'eggs'attributeerrortype object 'chas no attribute '__add__the net effectto code proxy of an object whose interface may in part be invoked by built-in operationsnew-style classes require both __getattr__ for normal namesas well as method redefinitions for all names accessed by built-in operations--whether coded manuallyobtained from superclassesor generated by tools when redefinitions are so incorporatedcalls through both instances and types are equivalent to built-in operationsthough redefined names are no longer routed to the generic __getattr__ undefined name handlereven for explicit name callsclass (object)new-style and data 'spamdef __getattr__(selfname)catch normal names print('getattrnamereturn getattr(self datanamedef __getitem__(selfi)redefine built-ins print('getitemstr( )return self data[irun expr or getattr def __add__(selfother)print('addotherreturn getattr(self data'__add__')(otherx ( advanced class topics