title: How can I make a class in python support __getitem__, but not allow iteration?
body: <p>I want to define a class that supports <code>__getitem__</code>, but does not allow iteration.
  for example:</p>
  
  <pre><code>class B:
     def __getitem__(self, k):
        return k
  
  cb = B()
  
  for x in cb:
     print x
  </code></pre>
  
  <p>What could I add to the class <code>B</code> to force the <code>for x in cb:</code> to fail?</p>