Overriding descriptors are descriptors that implement __set__. Therefore, the user can’t shadow any attribute that is defined as an overriding descriptor because any assignment at the to the instance’s attribute will be forced to go through the __set__ method. The below class utilizes @property, which is an overriding descriptor, to make an attribute as a read-only attribute.
class Test:def__init__(self):self._x =1@propertydef x(self):returnself._xc = Test()print(c.x) #=> 1c.x =10#=> AttributeError: can't set attribute 'x'
Non-overriding descriptors are descriptors that don’t implement __set__. This means that the user can shadow the attribute. The common example of a non-overriding descriptor is the instance methods. They are actually implemented using non-overriding descriptor with __get__ method.