title: Is there a decorator to simply cache function return values?
body: <p>Consider the following:</p>
  
  <pre><code>@property
  def name(self):
  
      if not hasattr(self, '_name'):
  
          # expensive calculation
          self._name = 1 + 1
  
      return self._name
  </code></pre>
  
  <p>I'm new, but I think the caching could be factored out into a decorator. Only I didn't find one like it ;)</p>
  
  <p>PS the real calculation doesn't depend on mutable values</p>