Is there a way to access an overridden method within a multiple inheritance object in Python?
Question: I have the following Python code. How do I get c to return 2 without changing
the class definitions? Or differently stated. How to access overridden methods
in an object with multiple inheritance?

    
    
    class A(object):
        def foo(self):
            return 1
    
    class B(object):
        def foo(self):
            return 2
    
    class C(A, B):
        def __init__(self):
            A.__init__(self)
            B.__init__(self)
    
    c = C()
    c.foo() # Returns 1
    


Answer: Just after asking this question I got an answer elsewhere so here goes:

    
    
    import types
    c.foo = types.MethodType(B.foo, c)
    

