AI engineering glossary · Python advanced

What is metaclass?

Metaclass: A class whose instances are themselves classes, controlling how classes are created. The default is type. Metaclasses can register or modify classes automatically, though simpler tools are usually preferred. Most everyday problems are better solved with decorators or inheritance.

Level: advancedTopic: Python advanced

Metaclass: an example

class Meta(type) can check at class creation that every subclass defines a required method.

Related terms

More Python advanced terms

Where you learn it

Metaclass is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.