I was writing a metaclass and accidentally did it like this:
class MetaCls(type):
def __new__(cls, name, bases, dict):
return type(name, bases, dict)
…instead of like this:
class MetaCls(type):
def __new__(cls, name, bases, dict):
return type.__new__(cls, name, bases, dict)
What exactly is the difference between these two metaclasses? And more specifically, what caused the first one to not work properly (some classes weren’t called into by the metaclass)?
In the first example you’re creating a whole new class:
while in the second case you’re calling parent’s
__new__: