Skip to main content This is the website for an older EuroPython. Looking for the latest EuroPython? Click here!
EuroPython logo

Descriptors - Understanding and Modifying Python's Attribute Access

Track:
Python Internals & Ecosystem
Type:
Tutorial
Level:
advanced
Room:
Club E
Start:
09:30 on 09 July 2024
Duration:
180 minutes

Abstract

Descriptors are advanced Python features. While it is possible to write Python programs without active knowledge of them, knowing more about them facilitates a deeper understanding of the language. With examples, you will learn how they work and how to write your own descriptors. Furthermore, you will understand when to use and when better not to use them.

This tutorial is a systematic introduction to descriptors. It covers all relevant information with a focus on practical applications for common tasks.

In hand-on sessions you will learn how to write your own descriptors that adapt attribute access to your needs. Use cases provide working code that can serve as a basis for your own solutions. You will gain a deeper understanding of more advanced concepts that can help to write better programs.

Software Requirements

You will need a recent Python version installed on your laptop. I will use Python 3.12. I recommend that use this version too. If this is not possible, you may use an older version starting from Python 3.7. There are no other requirements. You will receive the tutorial materials during the tutorial.

JupyterLab

I will use JupyterLab for the tutorial because it makes a very good teaching tool. I recommend that you also use JupyterLab. You may use Notebooks in PyCharm, VS Code, or other systems. If you don’t like Notebooks, you are welcome to use the setup you prefer, i.e editor, IDE, REPL.