title: Python 3.1: C3 method resolution order
body: <p>A very simple case of diamond-type inheritance:</p>
  
  <pre><code>class Root:
      def f(self):
          print('Root')
  
  class A(Root): pass
  
  class B(Root):
      def f(self):
          print('B')
  
  class AB(A, B): pass
  
  AB().f()
  </code></pre>
  
  <p>According to <a href="http://docs.python.org/py3k/tutorial/classes.html#multiple-inheritance" rel="nofollow noreferrer">Python 3.1.2 documentation</a>:</p>
  
  <blockquote>
    <p>For most purposes, in the simplest
    cases, you can think of the search for
    attributes inherited from a parent
    class as depth-first, left-to-right,
    not searching twice in the same class
    where there is an overlap in the
    hierarchy.</p>
  </blockquote>
  
  <p>Hence, I expect my example to resolve in the order: AB -> A -> Root -> B. But it doesn't. Using ActiveState Python 3.1.2, the output is 'B' rather than 'Root'. </p>
  
  <p>What am I missing?</p>
  
  <p>Also, I noticed that ActiveState Python 2.6 prints 'Root' with the same code. Did the resolution rules change between 2.6 and 3.1?</p>