title: TypeError after overriding the __add__ method
body: <p>I am trying to understand how <code>__add__</code> works:</p>
  <pre><code>class MyNum:
      def __init__(self,num):
          self.num=num
      def __add__(self,other):
          return MyNum(self.num+other.num)
      def __str__(self):
          return str(self.num)
  </code></pre>
  <p>If I put them in a list</p>
  <pre><code>d=[MyNum(i) for i in range(10)]
  </code></pre>
  <p>this works</p>
  <pre><code>t=MyNum(0)
  for n in d:
      t=t+n
  print t
  </code></pre>
  <p>But this does not:</p>
  <pre><code>print sum(d)
  TypeError: unsupported operand type(s) for +: 'int' and 'instance'
  </code></pre>
  <p>What am I doing wrong? How can I get the <strong>sum()</strong> to work?</p>
  <p>My problem is how to use the sum on a list of objects that support the <code>__add__</code>, need to keep it as generic as possible.</p>