title: Python method-wrapper type?
body: <p>What is the method-wrapper type in Python 3?  If I define a class like so:</p>
  
  <pre><code>class Foo(object):
      def __init__(self, val):
          self.val = val
      def __eq__(self, other):
          return self.val == other.val
  </code></pre>
  
  <p>And then do:</p>
  
  <pre><code>Foo(42).__eq__
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>&lt;bound method Foo.__eq__ of &lt;__main__.Foo object at 0x10121d0&gt;&gt;
  </code></pre>
  
  <p>But if I do (in Python <strong>3</strong> ):</p>
  
  <pre><code>Foo(42).__ne__
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>&lt;method-wrapper '__ne__' of Foo object at 0x1073e50&gt;
  </code></pre>
  
  <p>What is a "method-wrapper" type?</p>
  
  <p>Edit: sorry to be more accurate: <code>class method-wrapper</code> is the type of <code>__ne__</code>, as if I do:</p>
  
  <pre><code>&gt;&gt;&gt; type(Foo(42).__ne__)
  &lt;class 'method-wrapper'&gt;
  </code></pre>
  
  <p>Whereas the type of <code>__eq__</code> is:</p>
  
  <pre><code>&gt;&gt;&gt; type(Foo(42).__eq__)
  &lt;class 'method'&gt;
  </code></pre>
  
  <p>Furthermore <code>method-wrapper</code> seems to be the type of any undefined magic method on a class (so <code>__le__</code>, <code>__repr__</code>, <code>__str__</code> etc if not explicitly defined will also have this type).</p>
  
  <p>What I am interested in is how the <code>method-wrapper</code> class is used by Python.  Are all "default implementations" of methods on a class just instances of this type?</p>