title: Sum a list of object attributes
body: <p>I have a class defined as </p>
  
  <pre><code>class MyClass(object):
  
      def __init__(self, value=0):
          self.value = value
  
      def __add__(self,other):
          return MyClass(self.value + other.value)
  
      __radd__ = __add__
  </code></pre>
  
  <p>I would like simply to apply the <code>sum</code> function to them like this:</p>
  
  <pre><code>a=MyClass(value=1)
  b=MyClass(value=2)
  
  c=[a,b]
  print sum(c)  # should return a MyClass instance with value 3
  </code></pre>
  
  <p>as was suggested in <a href="https://stackoverflow.com/questions/1218710/pythons-sum-and-non-integer-values">this post</a>. However, an exception is raised:</p>
  
  <pre><code>     15 
       16 c=[a,b]
  ---&gt; 17 print sum(c)
  
  TypeError: unsupported operand type(s) for +: 'int' and 'MyClass'
  </code></pre>
  
  <p>I don't understand why the <code>sum</code> function wants to add two different types.</p>