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: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
One example is sqlite3
, here is a short example you can even use in the interpreter:
>>> import sqlite3
>>> x = type('x', (sqlite3,), {})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
sqlite3
is a module not a "class". – Edwyna