Python metaclasses is an abstruse OOP concept that lurks behind basically all Python code, it can be used to modify the behaviour of classes.

Metaprogramming refers to a programming technique that enables you to write code that can manipulate code. We’ve already discussed one form of metaprogramming supported by Python: decorators; this article will cover Python metaclasses. Before understanding metaclasses, you need to master classes in Python.

Borrowed from Smalltalk, Python has an odd idea of classes. Generally, classes are pieces of code that can be used to create objects. This is true for Python too, however, in Python, classes are objects too. Yes, objects. Everything in Python is an object, even classes.

#python #programming #developer

Complete Guide to Python Metaclasses
2.05 GEEK