title: Dynamically mixin a base class to an instance in Python
body: <p>Is it possible to add a base class to an object instance (not a class!) at runtime? Something along the lines of how <code>Object#extend</code> works in Ruby:</p>
  
  <pre><code>class Gentleman(object):
    def introduce_self(self):
      return "Hello, my name is %s" % self.name
  
  class Person(object):
    def __init__(self, name):
      self.name = name
  
  p = Person("John")
  # how to implement this method?
  extend(p, Gentleman)
  p.introduce_self() # =&gt; "Hello, my name is John"
  </code></pre>