title: Modify dict values inplace
body: <p>I would like to apply a function to values of a <code>dict</code> inplace in the <code>dict</code> (like <code>map</code> in a functional programming setting).</p>
  
  <p>Let's say I have this <code>dict</code>:</p>
  
  
  
  <pre class="lang-py prettyprint-override"><code>d = { 'a':2, 'b':3 }
  </code></pre>
  
  <p>I want to apply the function <code>divide by 2.0</code> to all values of the dict, leading to:</p>
  
  <pre class="lang-py prettyprint-override"><code>d = { 'a':1., 'b':1.5 }
  </code></pre>
  
  <p>What is the simplest way to do that?</p>
  
  <p>I use <em>Python 3</em>.</p>
  
  <p><strong>Edit:</strong>
  A one-liner would be nice. The <code>divide by 2</code> is just an example, I need the function to be a parameter.</p>