title: Why doesn't this python assignment work as obviously expected?
body: <p>This returns what you'd expect:</p>
  
  <pre><code>class My(object):
      def __len__(self):
          return 6
  
  a = My()
  print(len(a))
  </code></pre>
  
  <p>But this throws an error:</p>
  
  <pre><code>class My2(object):
      pass
  
  b = My2()
  b.__len__ = lambda x: 6
  print(len(b))
  </code></pre>
  
  <p><code>TypeError: object of type 'My2' has no len()</code></p>
  
  <p>Why?</p>