A first look at descriptors
First, we will explore the main idea behind descriptors to understand their mechanics and internal workings. Once this is clear, it will be easier to assimilate how the different types of descriptors work, which we will explore in the next section.
Once we have a first understanding of the idea behind descriptors, we will look at an example where their use gives us a cleaner and more Pythonic implementation.
The machinery behind descriptors
The way descriptors work is not all that complicated, but the problem with them is that there are a lot of caveats to take into consideration, so the implementation details are of the utmost importance here.
In order to implement descriptors, we need at least two classes. For the purposes of this generic example, we are going to call the client
class to the one that is going to take advantage of the functionality we want to implement in the descriptor
(this class is generally just a domain model one, a regular abstraction we create...