title: Python: comparison of two dict lists
body: <p>Here is what I want to achieve:</p>
  
  <p>I have got two lists of dictionaries. All the dictionaries have the following structure:</p>
  
  <pre><code>dictinary = {'name':'MyName', 'state':'MyState'}
  </code></pre>
  
  <p>I would like to go through all the elements of both lists and compare the states of the entries with the same name. Here is the best way that I can imagine:</p>
  
  <pre><code>for d in list1:
      name = d['name']
      for d2 in list2:
          if d2['name'] == name:
             if d1['state'] != d2['state']:
                 # Do something
  </code></pre>
  
  <p>While I think that this approach would work, I wonder whether there is a more efficient and/or elegant way to perform this operation. Thank you for your ideas!</p>