title: Comparing one dict value to all values large dict for all dict values
body: <p>I'm looking for a fast way to compare one value of dict to all values, and want to iterate through all values of the dict. </p>
  
  <p>I understand there is a going to be a lot of repetition in value checking, so
  I was trying to update the iterable (pop already iterated keys) during iteration, but it seems I can't modify the iterable during iteration.</p>
  
  <p>Here is the code I'm using:</p>
  
  <pre><code>#comparing value to all value2
  
  duplicates = []
  for key,value in image_dict_copy.items():
      for key2,value2 in image_dict_copy.items():
          if hamming_distance(value, value2) &gt; .85:
              duplicates.append((key, key2))
          image_dict_copy.pop(key)  #doesn't work
          print(len(image_dict_copy)) #trying to shrink the size of the iterable
  </code></pre>
  
  <p>Any suggestions as to how to improve the speed? It's pretty slow at the moment. </p>