title: overriding magic methods with __getattr__
body: <p>I have a class, that is a container for members. all members are of the same type.</p>
  
  <pre><code>class A(int):
      def __init__(self, n):
          super().__init__()
          self.n = n
  
      def do(self):
          print('adding 10')
          return self.n + 10
  
  
  class B:
      def __init__(self, a1, a2):
          self.a = [a1, a2]
  
      def __getattr__(self, item):
          return getattr(self.a[0], item)
  
  
  a1 = A(10)
  a2 = A(5)
  b = B(a1, a2)
  </code></pre>
  
  <p>the <code>__getattr__</code> overrides the <code>do</code> method:</p>
  
  <pre><code>In[7]: b.do()
  adding 10
  Out[7]: 20
  </code></pre>
  
  <p>and even overrides <code>__add__</code> when called explicitly</p>
  
  <pre><code>In[8]: b.__add__(1)
  Out[8]: 11
  </code></pre>
  
  <p>but <code>__add__</code> fails when called as <code>+</code></p>
  
  <pre><code>In[9]: b+1
  TypeError: unsupported operand type(s) for +: 'B' and 'int'
  </code></pre>
  
  <p>How can I override magic methods to work as expected?</p>