I need to create a class that uses a different base class depending on some condition. With some classes I get the infamous:
TypeError: metaclass conflict: t
To use the pattern described by @michael, but with both Python 2 and 3 compatibility (using the six library):
six
from six import with_metaclass class M_C(M_A, M_B): pass class C(with_metaclass(M_C, A, B)): # implement your class here