Q:

Two classes differing only in base class

I have come across a problem where I need two classes that will have identical implementation and the only difference between them will be different name and base class. What is a reasonable way of doing this?
One obvious solution is to violate DRY and copy the implementations like this:
class FooA(BaseA):
    def frobnicate(self):
        print("frob")

class FooB(BaseB):
    def frobnicate(self):
        print("frob")

A:

You can use multiple inheritance to implement interfaces and common functionality in a single mixin class. Given the clear desire to frobnicate in many classes, just implement a frobnicator. Python builds the class from right to left so mixins are left-most.
class Frobnicator(object):
    def frobnicate(self):
        print("frob")

class FooA(Frobnicator, BaseA):
    pass

class FooB(Frobnicator, BaseB):
    pass

Note that mixins usually do not implement their own __init__ - that's the job of the base class.

