Metaclasses. What are they? Where do they live? How do they reproduce?

Did you know that you can make your classes receive keyword arguments, just like functions? And that they can be decorated as well?

Do you want to understand how classes, metaclasses and decorators work and what are they good for?

In this hands-on coding session we will inspect the inner workings of how Python creates classes, and how decorators, meta-classes and methods from superclasses can influence this process.

We'll explore:

  • normal and special methods
  • how attribute lookup works between instances and classes
  • what are descriptors, and how they fit into attribute lookup process
  • what is the relationship between instances, classes and metaclasses
  • what are metaclasses for
  • and some other metaprogramming odds and ends

All that is required for you to enjoy this session is that you have written a class in Python. If you've done the original Python Tutorial, that should be more than enough.

Luciano Ramalho

Affiliation: Oficinas Ramgarlic

Luciano Ramalho is the author of Fluent Python, published in 9 languages and 2 editions since 2015. He was a pioneering organizer of the Python Brasil association, which supports the Brazilian national PyCon. He is now a writer, teacher, and model railroader.

visit the speaker at: Github

Leonardo Rochael Almeida

Affiliation: HelloFresh SE

Python developer with over 22 years of experience, Leonardo is a technical reviewer for Luciano Ramalho's "Fluent Python" book for both editions.

visit the speaker at: Github