title: Why is Python's 'len' function faster than the __len__ method?
body: <p>In Python, <code>len</code> is a function to get the length of a collection by calling an object's <code>__len__</code> method:</p>
  
  <pre><code>def len(x):
      return x.__len__()
  </code></pre>
  
  <p>So I would expect direct call of <code>__len__()</code> to be at least as fast as <code>len()</code>.</p>
  
  <pre><code>import timeit
  
  setup = '''
  '''
  
  print (timeit.Timer('a="12345"; x=a.__len__()', setup=setup).repeat(10))
  print (timeit.Timer('a="12345"; x=len(a)',      setup=setup).repeat(10))
  </code></pre>
  
  <p><strong><a href="http://ideone.com/0Egyq7" rel="noreferrer">Demo link</a></strong></p>
  
  <p>But results of testing with the above code shows <code>len()</code> to be faster. Why?</p>