title: How to create a dynamic variable?
body: <p>I would like to create a variable that will return a different value every-time it is queried.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>import datetime
  
  def getVal():
      return datetime.datetime.now().time()
  
  TMP_VAR = lambda: getVal()
  
  for a in range(0,10):
      print TMP_VAR()
  </code></pre>
  
  <p>This works and I get:</p>
  
  <pre class="lang-none prettyprint-override"><code>13:06:41.799504
  13:06:41.800129
  13:06:41.800139
  13:06:41.800145
  13:06:41.800161
  13:06:41.800167
  13:06:41.800173
  13:06:41.800179
  13:06:41.800184
  13:06:41.800190
  </code></pre>
  
  <p>How ever, <code>TMP_VAR</code> is a function now. Is there a way to get this working in the following fashion?</p>
  
  <pre><code>print TMP_VAR
  </code></pre>
  
  <p>Effectively, having a callable function linked to a variable. So everytime I pass my <code>TMP_VAR</code> into another function, as an argument it always re-evaluates and happens to be holding a new value (whatever the <code>getVal()</code> function is returning at that moment).</p>