This talk was presented at PyCon CZ 2017 and EuroPython 2017. Here are the references and resources for the presentation.

The code used for the talk, is available here and contains some explanations along with the examples.

Slides

Video

This is the recording of the talk presented at EuroPython 2017.

References

To learn more about descriptors, you could check some of the following references, used as base for the talk:

  • Fluent Python - by Luciano Ramalho: This book has a great cover of all topics of Python, and descriptors is no exception. Starting the section V of meta-programming, the chapter 20 contains a profound explanation of the internals of descriptors and how they work.
  • Python cookbook (3rd edition) - David Beazley & Brian Jones: Contains great examples of Python code, that help explaining advanced topics, such as descriptors, decorators, and more.
  • Python descriptors HowTo: The nicest thing about this guide is not only that helps a lot on the understanding of descriptors, but also that here you can find equivalent implementations of many built-in descriptors in Python, for example those for @property, @classmethod, etc. This helps a lot on the understanding of the internals of Python, and illustrates a part of the code that is implemented in C in CPython.
  • Python data model: has a section explaining the methods of the descriptor protocol, and how they're invoked.
  • PEP-487 introduces __set_name__.