What is a metaclass?

Python advanced features · Experienced

Model answer

A metaclass is the class of a class: it controls how classes are created (type is the default). They are used in frameworks for things like registering classes or ORMs. They are rarely needed. Class decorators or __init_subclass__ solve most problems more simply.

Learn this topic

The Python Standard Library: Dates, Counter, Statistics and More in the course Python for Beginners: Learn to Code with Real Projects.

Sign in to add your own answer.

More questions