Chapter 11. Descriptors
Descriptors are classes which provide access control for the attributes of other classes. Any class that implements one or more of the descriptor special methods,
__delete__(), is called (and can be used as) a descriptor.
classmethod() functions are implemented using descriptors. The key to understanding descriptors is that although we create an instance of a descriptor in a class as a class attribute, Python accesses the descriptor through the class’s instances.
To make things clear, let’s imagine that we have a class whose instances hold some strings. We want to access the strings in the normal way, for example, as a property, but we also want to get an ...