EuroPython 2015

Python decorators in detail

Do you know what happens every time you use the @ symbol in Python? Do you know how to implement a decorator to be customisable at decoration time or to internally store a state?

After attending this training you will be able to answer yes to all the previous questions!

The content of the session can be split in 3 main blocks:

  • 1/ Some Python basic concepts
    • Scopes
    • Namespaces
    • Closures
  • 2/ Implement and understand a basic decorator
  • 3/ Advanced decorators
    • Generators of decorators
    • Classes as decorators
    • Decoration of classes

Requirements:

  • Intermediate Python level. Attendees must have previous knowledge of Python and should be somehow familiar with the notation @ to decorate a function or class.
  • Bring your own laptop with Python installed and ready to solve some coding exercises.

The code and exercises of the training can be downloaded from here: https://github.com/pablito56/decorators/

PS: I also delivered a talk which covers in a more graphical way the first part of the training: https://ep2015.europython.eu/conference/talks/decorators-demystified

in on Friday 24 July at 11:00 See schedule
in on Friday 24 July at 11:00 See schedule

Do you have some questions on this talk?

New comment