title: Update a value in a list of dictionaries in python based on a condition based on the value of another key in that dictionary
body: <p>Given a list of dictionaries:</p>
  
  <pre><code>the_list = [{k1:v1,k2:v2}, {k1:v3, k3:v4}, {k1:v5,k2:v6},{k3:v7}]
  </code></pre>
  
  <p>How can I update the value for <code>k2</code> based on a condition based on the value of <code>k1</code>?</p>
  
  <p>I would come up with this solution but it doesn't feel Pythonic. Better solutions anyone?</p>
  
  <pre><code>for item in the_list:
    if set([k1,k2]) &lt;= item.keys():
      #cond evaluates to True or False
      if cond(item[k1]):
        item.update({k2:newvalue})
  </code></pre>
  
  <p>Maybe this can be done better with a map or lambda expression?</p>