title: What is the difference between a function, an unbound method and a bound method?
body: <p>I'm asking this question because of a discussion on the comment thread of <a href="https://stackoverflow.com/a/11934332/1523776">this answer</a>. I'm 90% of the way to getting my head round it.</p>
  
  <pre><code>In [1]: class A(object):  # class named 'A'
     ...:     def f1(self): pass
     ...:
  In [2]: a = A()  # an instance
  </code></pre>
  
  <p><code>f1</code> exists in three different forms:</p>
  
  <pre><code>In [3]: a.f1  # a bound method
  Out[3]: &lt;bound method a.f1 of &lt;__main__.A object at 0x039BE870&gt;&gt;
  In [4]: A.f1  # an unbound method
  Out[4]: &lt;unbound method A.f1&gt;
  In [5]: a.__dict__['f1']  # doesn't exist
  KeyError: 'f1'
  In [6]: A.__dict__['f1']  # a function
  Out[6]: &lt;function __main__.f1&gt;
  </code></pre>
  
  <p>What is the difference between the <em>bound method</em>, <em>unbound method</em> and <em>function</em> objects, all of which are described by f1? How does one call these three objects? How can they be transformed into each other? The <a href="http://docs.python.org/reference/datamodel.html#invoking-descriptors" rel="noreferrer">documentation</a> on this stuff is quite hard to understand.</p>