title: How to use a specific data structure as the default_factory for a defaultdict?
body: <p>I am currently using a <code>defaultdict</code> of <code>Counter</code> to uniquely count several unpredictable values for unpredictable keys:</p>
  
  <pre><code>from collections import defaultdict, Counter
  
  d = defaultdict(Counter)
  d['x']['b'] += 1
  d['x']['c'] += 1
  print(d)
  </code></pre>
  
  <p>This gives me the expected result:</p>
  
  <pre><code>defaultdict(&lt;class 'collections.Counter'&gt;, {'x': Counter({'c': 1, 'b': 1})})
  </code></pre>
  
  <p>I now need to expand the structure of the values in the <code>defaultdict</code> and make it a <code>dict</code> with two keys: the previous <code>Counter</code> and an <code>str</code>:</p>
  
  <pre><code>mystruct = {
      'counter': collections.Counter(),
      'name': ''
  }
  </code></pre>
  
  <p>Is it possible to use a specific data structure (like the above) as the <code>default_factory</code> in <code>defaultdict</code>? The expected result would be that for each nonexistent key in the <code>defaultdict</code>, a new key and value initialized with the structure above would be created.</p>