title: Iterating over collections.defaultdict(list)
body: <pre><code>import itertools
  import collections
  
  def get_pairs(some_list, limit):
      min = 2
      pair_dict = collections.defaultdict(list)
  
      for x in range(min, limit+1):
          pair_dict[x].append(list(itertools.combinations(some_list, x)))
  
      return pair_dict
  
  z = get_pairs([1, 2, 3, 4], 4)
  for key, value in z.items():
      print("Key: {}", "Value: {}".format(key, value))
  
  Output:
  Key: {} Value: 2
  Key: {} Value: 3
  Key: {} Value: 4
  </code></pre>
  
  <p>I was expecting key to come as 2, 3, 4 and value to be a list.
  Something like below</p>
  
  <pre><code>{
   2: [[(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]], 
   3: [[(1, 2, 3), (1, 2, 4), (1, 3, 4), (2, 3, 4)]], 
   4: [[(1, 2, 3, 4)]]
  }
  </code></pre>
  
  <p>What is wrong with my code or am I missing something here?</p>