use (objectin "name descriptor docsdef __get__(selfinstanceowner)print('fetch 'return instance _name def __set__(selfinstancevalue)print('change 'instance _name value def __delete__(selfinstance)print('remove 'del instance _name class persondef __init__(selfname)self _name name name name(use (objectin bob person('bob smith'print(bob namebob name 'robert smithprint(bob namedel bob name bob has managed attribute runs name __get__ runs name __set__ print('-'* sue person('sue jones'print(sue nameprint(name __doc__assign descriptor to attr runs name __delete__ sue inherits descriptor too or help(namenotice in this code how we assign an instance of our descriptor class to class attribute in the client classbecause of thisit is inherited by all instances of the classjust like class' methods reallywe must assign the descriptor to class attribute like this --it won' work if assigned to self instance attribute instead when the descriptor' __get__ method is runit is passed three objects to define its contextself is the name class instance instance is the person class instance owner is the person class when this code is run the descriptor' methods intercept accesses to the attributemuch like the property version in factthe output is the same againc:\codepy - desc-person py fetch bob smith change fetch robert smith remove fetch sue jones name descriptor docs managed attributes