also like in the property exampleour descriptor class instance is class attribute and thus is inherited by all instances of the client class and any subclasses if we change the person class in our example to the followingfor instancethe output of our script is the sameclass superdef __init__(selfname)self _name name name name(class person(super)pass descriptors are inherited (class attrsalso note that when descriptor class is not useful outside the client classit' perfectly reasonable to embed the descriptor' definition inside its client syntactically here' what our example looks like if we use nested classclass persondef __init__(selfname)self _name name class name"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 name name(using nested class when coded this wayname becomes local variable in the scope of the person class statementsuch that it won' clash with any names outside the class this version works the same as the original--we've simply moved the descriptor class definition into the client class' scope--but the last line of the testing code must change to fetch the docstring from its new location (per the example file desc-person-nested py)print(person name __doc__differsnot name __doc__ outside class computed attributes as was the case when using propertiesour first descriptor example of the prior section didn' do much--it simply printed trace messages for attribute accesses in practicedescriptors can also be used to compute attribute values each time they are fetched the following illustrates--it' rehash of the same example we coded for propertiesdescriptors