title: Finding matching keys in two large dictionaries and doing it fast
body: <p>I am trying to find corresponding keys in two different dictionaries.  Each has about 600k entries.</p>
  
  <p>Say for example:</p>
  
  <pre><code>    myRDP = { 'Actinobacter': 'GATCGA...TCA', 'subtilus sp.': 'ATCGATT...ACT' }
      myNames = { 'Actinobacter': '8924342' }
  </code></pre>
  
  <p>I want to print out the value for Actinobacter (8924342) since it matches a value in myRDP.</p>
  
  <p>The following code works, but is very slow:</p>
  
  <pre><code>    for key in myRDP:
          for jey in myNames:
              if key == jey:
                  print key, myNames[key]
  </code></pre>
  
  <p>I've tried the following but it always results in a KeyError:</p>
  
  <pre><code>    for key in myRDP:
          print myNames[key]
  </code></pre>
  
  <p>Is there perhaps a function implemented in C for doing this?  I've googled around but nothing seems to work.</p>
  
  <p>Thanks.</p>