title: How special method lookup works?
body: <pre><code>&gt;&gt;&gt; class B():
  ...     pass
  ...
  &gt;&gt;&gt; class C(object):
  ...     pass
  ...
  &gt;&gt;&gt; b = B()
  &gt;&gt;&gt; b.__len__ = lambda: 7
  &gt;&gt;&gt; len(b)
  7
  &gt;&gt;&gt; c = C()
  &gt;&gt;&gt; c.__len__ = lambda: 5
  &gt;&gt;&gt; len(c)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: object of type 'C' has no len()
  </code></pre>
  
  <p>It is mentioned in <a href="https://docs.python.org/2/reference/datamodel.html#special-method-lookup-for-new-style-classes" rel="nofollow">Python's documentation</a>, but I still don't understand how it works.</p>