Summary

Descriptors are a more advanced feature in Python that push the boundaries, closer to metaprogramming. One of their most interesting aspects is how they make crystal-clear that classes in Python are just regular objects, and, as such, they have properties and we can interact with them. Descriptors are, in this sense, the most interesting type of attribute a class can have because its protocol facilitates more advanced, object-oriented possibilities.

We have seen the mechanics of descriptors, their methods, and how all of this fits together, making a more interesting picture of object-oriented software design. By understanding descriptors, we were able to create powerful abstractions that yield clean and compact classes. We have seen ...

Get Clean Code in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.