title: How is __eq__ handled in Python and in what order?
body: <p>Since Python does not provide left/right versions of its comparison operators, how does it decide which function to call?</p>
  <pre><code>class A(object):
      def __eq__(self, other):
          print &quot;A __eq__ called&quot;
          return self.value == other
  class B(object):
      def __eq__(self, other):
          print &quot;B __eq__ called&quot;
          return self.value == other
  
  &gt;&gt;&gt; a = A()
  &gt;&gt;&gt; a.value = 3
  &gt;&gt;&gt; b = B()
  &gt;&gt;&gt; b.value = 4
  &gt;&gt;&gt; a == b
  &quot;A __eq__ called&quot;
  &quot;B __eq__ called&quot;
  False
  </code></pre>
  <p>This seems to call both <code>__eq__</code> functions.</p>
  <p>I am looking for the official decision tree.</p>