Practical introduction to descriptors
07-18, 15:30–17:00 (Europe/Prague), Club B

Descriptors are not black magic and this practical tutorial will show you that.
In fact, you use descriptors every day and you don't even know it!

Through a series of practical, hands-on exercises, you will learn

  • how to create a descriptor;
  • how to use the dunder methods __get__, __set__, and __set_name__;
  • what the descriptor protocol is; and
  • where descriptors show up in day-to-day Python code.

The expected Python level for participants is “intermediate”.
In practice, if you are comfortable with using the built-in property and if you have used dunder methods before, you should be fine.

This tutorial is based off of an article I wrote about descriptors.

All materials can be accessed from this GH repo.

Expected audience expertise


Rodrigo has always been fascinated by problem solving and that is why he picked up programming – so that he could solve more problems. He also loves sharing knowledge, and that is why he spends so much time writing articles in his blog, writing on Twitter @mathsppblog, and giving workshops and courses.

His main areas of scientific interest are mathematics (numerical analysis in particular) and programming in general (with a preference for the Python and APL languages), but Rodrigo also enjoys reading fantasy books, watching silly comedy movies and eating chocolate.

All materials can be accessed from this GH repo.

This speaker also appears in: