What is a metaclass in Python?
Answers
Answered by
2
A class defines how an instance of the class (i.e. an object) behaves while a metaclass defines how a class behaves. A class is an instance of a metaclass. While in Python you can use arbitrary callables for metaclasses (like Jerub shows), the better approach is to make it an actual class itself.
Answered by
0
Answer:
A metaclass is a class whose instances are classes. Like an "ordinary" class defines the behavior of the instances of the class, a metaclass defines the behavior of classes and their instances. Metaclasses are not supported by every object oriented programming language.
Explanation:
Similar questions