class mylistsub(mylist)calls def __init__(selfstart)self adds mylist __init__(selfstartdef __add__(selfother)print('addstr(other)mylistsub calls + self adds + return mylist __add__(selfotherdef stats(self)return self callsself adds shared by instances varies in each instance class-wide counter per-instance counts all addsmy adds if __name__ ='__main__' mylistsub('spam' mylistsub('foo'print( [ ]print( [ :]print( ['eggs']print( ['toast']print( ['bar']print( stats() :\codepython mysub py [' '' '' 'add['eggs'[' '' '' '' ''eggs'add['toast'[' '' '' '' ''toast'add['bar'[' '' '' ''bar'( attribute methods worked through this exercise as follows notice that in python ' classic classesoperators try to fetch attributes through __getattr__tooyou need to return value to make them work as noted in and elsewhere__getattr__ is not called for built-in operations in python (and in if newstyle classes are used)so the expressions aren' intercepted at all herein new-style classesa class like this must redefine __x__ operator overloading methods explicitly more on this in and it can impact much codec:\codepy - class attrsdef __getattr__(selfname)print('get %snamedef __setattr__(selfnamevalue)print('set % % (namevalue) appendix dsolutions to end-of-part exercises