Pieter van Oostrum <piete...@vanoostrum.org> writes: > Your Pardon is not a class, it is a function. Class A is created by > type(cls, *args), so 'type' is the metaclass of A, and therefore also of > B. > Creation of B does not call Pardon.
With a class it *does* work: In [74]: class Pardon(type): ... def __init__(cls, *args): ... print("Calling Pardon with", cls) In [75]: class A(metaclass=Pardon): pass Calling Pardon with <class '__main__.A'> In [76]: class B(A): pass Calling Pardon with <class '__main__.B'> -- Pieter van Oostrum www: http://pieter.vanoostrum.org/ PGP key: [8DAE142BE17999C4] -- https://mail.python.org/mailman/listinfo/python-list