title: function inside list comprehension - is it evaluated multiple times
body: <p>Which one's a better way of doing list comprehension in python (in terms of computation time &amp; cpu cycles). 
  In example (1) is the value f(r) evaluated in each iteration or is it evaluated once and cached ? </p>
  
  <ol>
  <li><p><code>y = [x*f(r) for x in xlist]</code></p></li>
  <li><p><code>c = f(r)</code></p>
  
  <p><code>y = [x*c for x in xlist]</code></p></li>
  </ol>
  
  <p>where</p>
  
  <pre><code>def f(r):
      ... some arbitrary function ...
  </code></pre>