defaultdict and tuples
<p>I wanted to do the following:</p>

<pre><code>d = defaultdict((int,float))
for z in range( lots_and_lots):
  d['operation one'] += (1,5.67)
  ...
  ...
  d['operation two'] += (1,4.56)
</code></pre>

<p>And then output the number of times each operation was called and the total of float value.</p>

<pre><code>for k,v in d.items():
  print k, 'Called', v[0], 'times, total =', v[1] 
</code></pre>

<p>But I don't know how to achieve this as not only can't you use a tuple as a parameter to defaultdict you can't add a tuple to a tuple and total the values in the tuple you just get extra values in your tuple.  i.e:</p>

<pre><code>&gt;&gt;&gt; x = (1,0)
&gt;&gt;&gt; x+= (2,3)
&gt;&gt;&gt; x
(1, 0, 2, 3)
</code></pre>

<p>and not</p>

<pre><code>&gt;&gt;&gt; x = (1,0)
&gt;&gt;&gt; x+= (2,3)
&gt;&gt;&gt; x
(3,3)
</code></pre>

<p>How can I get what I want?</p>
