PyCon, the gathering for the community using and developing the open-source Python programming language. This is the first year of the PyCon Pune where the community will meet for two days of talks and working on upstream projects in two days of dev sprint. CFP ends on 30th November AoE.
Practical Metaclasses and Decorators
Python gives developers direct control over every stage of the OOP process. Metaclasses are the framework used in creating classes themselves and an understanding of how decorators work bring a new light on what is happening behind the scenes. These programming tools are often considered to be among the black magic tools of expert python developers. However, they are not as scary as they look.
In this talk, I will explain how metaclasses work and present some practical examples, including a minimally invasive way to add full usage/error logging to your entire application. I will also describe how decorators work and touch on descriptors.
When you leave my talk, you will have a newfound understanding of the power that metaclass programming and decorators can give you.
- What is it
- Why is it relevant
- How it works
- Building a class definition using code
- What is a decorator
- How decorators work
- Gotchas and workarounds
###Tying it together
- Example of adding minimally invasive usage logging
Sim is a principal engineer at Red Hat with 20 years of python programming experience. His experience includes DevOps, CI, software development, database design and development and system administration.