title: Inherit from both 'heapq' and 'deque' in python?
body: <p>I'am trying to implement a 'heapq' or a 'deque' dynamically (according to user's input) </p>
  
  <pre><code>class MyClass():
  
      def __init__(self,  choose = True ):
      self.Q = []
      self.add = self.genAdd(choose)
      self.get = self.genGet(choose)
  
      def genAdd(self, ch):
          if(ch == True):
              def f(Q, elem):
                  return Q.append
          else:
              def f(Q):
                  return heappush
          return f
  </code></pre>
  
  <p>and same for 'genGet'</p>
  
  <p>the execution is correct on one side (x)or the other (but not both at the same time). I get things like</p>
  
  <pre><code>TypeError: f() takes exactly 1 argument (2 given)
  </code></pre>
  
  <p>tried multiple inhreitance but got</p>
  
  <pre><code>TypeError: Error when calling the metaclass bases
  metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
  </code></pre>
  
  <p>the problem is that heapq is called with</p>
  
  <pre><code>heappush(Q, elem)
  </code></pre>
  
  <p>and queue with</p>
  
  <pre><code>Q.append(elem)
  </code></pre>
  
  <p>I hope the point is clear. I think there should be a way to fix that (maybe using lambda)</p>
  
  <p>Thanks</p>