title: Overriding __getitem__ on python
body: <p>I want to override the <code>__getitem__</code> method on a class. I know there are similar questions, but I wanted to be more precise and clear. How do I make this work:</p>
  <pre class="lang-py prettyprint-override"><code>class A:
      def __init__(self, l: list): self.l = l
      def __getitem__(self, i: int): return self.l[i]
  
  l = [1,2,3,4,5]
  a = A(l)
  a[3]
  &gt;&gt; 4
  </code></pre>
  <p>So this works as expected, now I want to create class B that modifies the behaviour of <code>__getitem__</code>:</p>
  <pre class="lang-py prettyprint-override"><code>class B(A):
      def __getitem__(self, i: int):
          return super()[i]+1
  
  b = B(l)
  b[3]
  &gt;&gt; ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-172-77fe0ff98a6a&gt; in &lt;module&gt;
        1 b = B(l)
  ----&gt; 2 b[3]
  
  &lt;ipython-input-165-7856a4b2c20b&gt; in __getitem__(self, i)
        1 class B(A):
        2     def __getitem__(self, i):
  ----&gt; 3         return super()[i]+1
  
  TypeError: 'super' object is not subscriptable
  </code></pre>
  <p>Probably I am making a very silly mistake, but if I do the same thing with a method called <code>f</code> it works as expected.</p>