Python metaclasses: How they work and when to use a decorator instead

Python metaclasses: How they work and when to use a decorator instead

What is a Python metaclass?

– A subclass of type
– Classes can be instances of a metaclass, rather than type
– The metaclass’s __init__ sets attributes and methods

Realistically, you should probably use a decorator instead of a metaclass.

(But they’re fun to play with!)