title: Python Multiple Inheritance/Mixin
body: <p>I have the following problem:</p>
  
  <pre><code>class A:
      animal = 'gerbil'
  
      def __init__(self):
          self.result = self.calculate_animal()
  
      def calculate_animal(self):
          print(self.animal)
          return self.animal
  
  class B(A):
      animal = 'zebra'
  
      def __init__(self):
          super(B, self).__init__()
  </code></pre>
  
  <p>Now, I want a certain set of subclasses from A, to implement a new function that calculates something different with the animal, like so:</p>
  
  <pre><code>class CapitalizeAnimal:
  
      def calculate_animal(self):
          self.animal = self.animal.upper()
          # I need to call some version of super().self.animal,
          # but how will this Mixin class know of class A?
  
  
  class C(A, #CapitalizeAnimal?):
      animal = 'puma':
  
      def __init__(self):
          super(C, self).__init__()
  </code></pre>
  
  <p>How do I get <code>class C</code> to implement the <code>CapitalizeAnimal</code> version of <code>calculate_animal</code>, while keeping its animal as <code>puma</code>? I'm confused at how the Mixin class will be able to call a super() function.</p>