2025-07-26 –, D -114, Floor -1 (Room Azores)
Decorators are often thought of as functions that accept functions as arguments and that return other functions...
In this hands-on workshop you will see that this is not always right.
This hands-on workshop is divided into 4 sections of 30 minutes each:
- Decorators refresher.
- Advanced function decorators.
- Classes as decorators.
- Decorating classes.
Each section is divided into 15 minutes of live-coded lecture and 15 minutes for exercises where participants work in pairs to solve coding exercises.
The first section briefly recaps the fundamental concepts behind function decorators and the second section introduces the concepts required to write decorators with arguments.
The third section shows how classes can also be decorators, allowing you to create flexible and powerful decorators that leverage the full strength of OOP.
Finally, the fourth section shows how to apply decorators to classes, typically for the purpose of streamlining the definition of some boilerplate code.
Pre-requisites: attendees are expected to have used decorators before and to have written one or two decorators for themselves. Attendees are expected to be comfortable writing classes, methods, and implementing the dunder method __init__
.
Set-up: your IDE of choice and Python 3.12+.
Reference materials: the reference materials can be found online at https://decorators.mathspp.com
Intermediate
What are the main topics of your talk?:decorators, standard library
Rodrigo Girão Serrão is the author of multiple independently published books on Python, programming, and mathematics, and frequently blogs about those same topics.
Rodrigo has also presented talks and tutorials at some of the largest Python conferences in the world, including PyCon US, EuroPython, and multiple European PyCons.
By creating technical content that is easily digestible by those looking to improve their Python knowledge, Rodrigo is working to help everyone appreciate the elegance of the Python language and to make an effective use of the tools it provides.
When he is not working or writing, Rodrigo can be found playing board games, walking his dog, or exercising at the gym.