Metaclass not being called in subclasses
Here is a python session. >>> class Z(type): def __new__(cls, name, bases, attrs): print cls print name return type(name, bases, attrs) ... >>> class Y(object): __metaclass__ = Z ... <class '__main__.Z'> Y >>> class X(Y): ... pass ... >>> class W(Y): ... __metaclass__ = Z ... <class '__main__.Z'> W >>> After I define class X I expect Z._new__ to be called for it, and to print the two line, which is not happening, (as metaclass are inherited?) The problem is that the cls argument (which is the metaclass object) is not passed on when you call type , therefore the class object Y that is created