A mixin is a class that provides some functionality that can be easily incorporated in other classes. Mixins usually provide some standalone functionality that can be reused in many different classes.
Python supports Multiple inheritance. Multiple inheritance means that a class can inherit from multiple parents.
Multiple inheritance also implies that the order of parent classes becomes important. Python has the concept of MRO. MRO or Method Resolution Order is the order in which Python looks for a method in a hierarchy of classes. The order goes from left to right, which means the right most can be considered as the base(-est) class. The methods in the classes on the right will get over written by the methods in the classes on the left.
class A:
def whoami(self):
print("A")
class B:
def whoami(self):
print("B")
class C:
def whoami(self):
print("C")
class D(C, B, A):
pass
d = D()
d.whoami()
# Prints: C
If a method is in classes A, B and C, the method in class C will override the methods in class A and B.