I have a class, Mixed
which needs to mix in the class SomeMixin
. But Mixed
does not need a base class.
This syntax would seem to make SomeMixin
a base class rather than a mixin:
class Mixed(SomeMixin):
But the more intuitive syntax throws an error:
class SomeMixin:
pass
class Mixed(object, SomeMixin):
def __init__(self):
pass
Traceback (most recent call last): File "<input>", line 1, in <module> TypeError: Cannot create a consistent method resolution order (MRO) for bases object, SomeMixin
How can I use a mixin in a class which does not require a base class?