these generally computes value for instance accessand the latter usually returns self if descriptor object access is supported for examplein the following sessionwhen attr is fetchedpython automatically runs the __get__ method of the descriptor class instance to which the subject attr class attribute is assigned in xuse the print statement equivalentand derive both classes here from objectas descriptors are new-style class toolin this derivation is implied and can be omittedbut doesn' hurtclass descriptoradd "(object)in def __get__(selfinstanceowner)print(selfinstanceownersep='\ 'add "(object)in descriptor instance is class attr class subjectattr descriptor( subject( attr subject attr none notice the arguments automatically passed in to the __get__ method in the first attribute fetch--when attr is fetchedit' as though the following translation occurs (though the subject attr here doesn' invoke __get__ again) attr -descriptor __get__(subject attrxsubjectthe descriptor knows it is being accessed directly when its instance argument is none read-only descriptors as mentioned earlierunlike propertiessimply omitting the __set__ method in descriptor isn' enough to make an attribute read-onlybecause the descriptor name can be assigned to an instance in the followingthe attribute assignment to stores in the instance object xthereby hiding the descriptor stored in class cclass ddef __get__(*args)print('get'class ca ( ( get managed attributes attribute is descriptor instance runs inherited descriptor __get__