2025-04-25 –, Ferrum
Whenever you use a dot in Python you access an attribute.
While this seems a very simple operation,
behind the scenes many things can happen.
This tutorial looks into this mechanism that is regulated by descriptors.
You will learn how a descriptor works and what kind of problems it can help to
solve.
Python properties are based on descriptors and solve one type of problems.
Descriptors are more general, allow more use cases, and are more re-usable.
Descriptors are an advanced topic.
But once mastered, they provide a powerful tool to hide potentially complex
behavior behind a simple dot.
Whenever you use a dot in Python you access an attribute.
While this seems a very simple operation,
behind the scenes many things can happen.
This tutorial looks into this mechanism that is regulated by descriptors.
You will learn how a descriptor works and what kind of problems it can help to
solve.
Python properties are based on descriptors and solve one type of problems.
Descriptors are more general, allow more use cases, and are more re-usable.
Descriptors are an advanced topic.
But once mastered, they provide a powerful tool to hide potentially complex
behavior behind a simple dot.
In this tutorial you will:
- Learn how to use Python's descriptors to add new functionality to attribute access
- Acquired solid background knowledge on how descriptors work
- Work with practical examples for applying descriptors
- Learn when to use a property or reach for a descriptor
- Get to know how popular Python libraries apply descriptors for tasks such as
data structure access, REST-APIs, ORMs, and serialization
None
Expected audience expertise: Python:Advanced
I've been a Python user since 1999, teaching Python professionally since 2004.
I am also active in the community, organizing Python conferences such as
PyCon DE, EuroSciPy, and BarCamps.
I am a PSF Fellow, PSF Community Service Award winner,
and chair of the German Python Software Verband.