title: Python __index__ special method
body: <pre><code>&gt;&gt;&gt; class Thing(object):
  ...     def __index__(self):
  ...         return 1
  ... 
  &gt;&gt;&gt; thing = Thing()
  &gt;&gt;&gt; list_ = ['abc', 'def', 'ghi']
  &gt;&gt;&gt; list_[thing]
  'def'
  &gt;&gt;&gt; dict_ = {1: 'potato'}
  &gt;&gt;&gt; dict_[thing]
  # KeyError
  </code></pre>
  
  <p>How does <code>thing</code> know to represent itself as 1 when accessed by a list, but not by a dict?  Don't both magic methods go through <code>__getitem__</code>?  The usage shown for lists could go through <code>__int__</code> instead so what is the <em>raison d'être</em> for <code>__index__</code> anyway?</p>