title: sum over values in python dict except one
body: <p>Is there a way to sum over all values in a python dict except one by using a selector in </p>
  
  <pre><code>&gt;&gt;&gt; x = dict(a=1, b=2, c=3)
  &gt;&gt;&gt; np.sum(x.values())
  6
  </code></pre>
  
  <p>?
  My current solution is a loop based one:</p>
  
  <pre><code>&gt;&gt;&gt; x = dict(a=1, b=2, c=3)
  &gt;&gt;&gt; y = 0
  &gt;&gt;&gt; for i in x:
  ...     if 'a' != i:
  ...             y += x[i]
  ... 
  &gt;&gt;&gt; y
  5
  </code></pre>
  
  <p>EDIT: </p>
  
  <pre><code>import numpy as np
  from scipy.sparse import *
  x = dict(a=csr_matrix(np.array([1,0,0,0,0,0,0,0,0]).reshape(3,3)),      b=csr_matrix(np.array([0,0,0,0,0,0,0,0,1]).reshape(3,3)), c=csr_matrix(np.array([0,0,0,0,0,0,0,0,1]).reshape(3,3)))
  y = csr_matrix((3,3))
  for i in x: 
      if 'a' != i:
          y = y + x[i]
  print y
  </code></pre>
  
  <p>returns <code>(2, 2)   2.0</code></p>
  
  <p>and </p>
  
  <pre><code>print np.sum(value for key, value in x.iteritems() if key != 'a')
  </code></pre>
  
  <p>raises</p>
  
  <pre><code>File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-    packages/numpy/core/fromnumeric.py", line 1446, in sum
      res = _sum_(a)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/compressed.py", line 187, in __radd__
      return self.__add__(other)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/compressed.py", line 173, in __add__
      raise NotImplementedError('adding a scalar to a CSC or CSR '
  NotImplementedError: adding a scalar to a CSC or CSR matrix is not supported
  </code></pre>