On 11/04/20 12:19 am, Pieter van Oostrum wrote:

Your Pardon is not a class, it is a function.

To elaborate on that a bit, the way inheritance of metaclasses
works is that when you define a class, if you don't explicity
specify a metaclass, it uses the class of the base class as
the metaclass.

Usually when you specify a metaclass, you use an actual class.
But your "metaclass" is a function that returns an instance
of class "type". So the class of your base class ends up
being "type", which is no different from what it would have
been if you didn't specify a metaclass.

I find it peculiar that you can give a function as metaclass.

Yes, it just calls whatever object you give it, which allows
for various fun things. You'd be risking a lynching if you took
advantage of it for anything important, though.:-)

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to