[Python-Dev] Metatype conflict among bases?
Guido van Rossum
guido@python.org
Tue, 22 Apr 2003 20:23:47 -0400
> Consider:
>
> class A(object):
> class __metaclass__(type):
> pass
>
> class B(A): # TypeError: metatype conflict among bases
> class __metaclass__(type):
> pass
>
> Now that's a weird error message at least! There's only one base (A),
> and I'm telling Python explicitly to use the nested __metaclass__
> instead of A's __metaclass__!
>
> Should I not be surprised that Python won't let me set the metatype
> explicitly?
The metaclass must be a subclass of the metaclass of all the bases.
--Guido van Rossum (home page: http://www.python.org/~guido/)