title: How does python compare functions?
body: <p>How come this doesn't rise Attribute error? function object doesn't have any of the comparison methods. Does it use id() somehow?</p>
  
  <pre><code>fun1 = lambda:x
  fun2 = lambda:x
  print fun1 == fun1 # True
  print fun1 == fun2 # False
  print fun1 &gt; fun2 # True
  print fun1 &lt; fun2 # False
  print fun1 &gt; 1 # True
  </code></pre>
  
  <p>I understand that it compares addresses, but how?
  Is it some low level hack in to intercept __lt__, __eq__ etc. ?</p>