title: Instancemethod or function?
body: <p>Today I defined a class just for testing what comes next:</p>
  
  <pre><code>class B(object):
      def p(self):
          print("p")
  </code></pre>
  
  <p>And later I did this:</p>
  
  <pre><code>&gt;&gt;&gt; type(B.__dict__['p'])
  &lt;type 'function'&gt;
  &gt;&gt;&gt; type(B.p)
  &lt;type 'instancemethod'&gt;
  </code></pre>
  
  <p>So, why? Aren't <code>B.p</code> and <code>B.__dict__['p']</code> the same object? </p>
  
  <p>My astonishment just increased when a I tried this:</p>
  
  <pre><code>&gt;&gt;&gt; B.__dict__['p']
  &lt;function p at 0x3d2bc80&gt;
  &gt;&gt;&gt; type(B.__dict__['p'])
  &lt;type 'function'&gt;
  </code></pre>
  
  <p>Ok, so far so good, the type is in both results <code>function</code>, but when I tried:</p>
  
  <pre><code>&gt;&gt;&gt; B.p
  &lt;unbound method B.p&gt;
  &gt;&gt;&gt; type(B.p)
  &lt;type 'instancemethod'&gt;
  </code></pre>
  
  <p>What?!, Why? <code>unbound method</code> and <code>instancemethod</code>? Are those the same? Why two different names?</p>
  
  <p>Well, It seems python is full of surprises!</p>
  
  <p>And this is the python I'm using:</p>
  
  <pre><code>Python 2.7.4 (default, Sep 26 2013, 03:20:26) 
  [GCC 4.7.3] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  </code></pre>