title: Python decorator class to transform methods to dictionary items
body: <p>I wonder if there is a reasonable easy way to allow for this code (with minor modifications) to work.</p>
  
  <pre><code>class Info(object):
      @attr("Version")
      def version(self):
          return 3
  
  info = Info()
  assert info.version == 3
  assert info["Version"] == 3
  </code></pre>
  
  <p>Ideally, the code would do some caching/memoising as well, e.g. employ lazy attributes, but I hope to figure that out myself.</p>
  
  <p><strong>Additional information:</strong></p>
  
  <p>The reason why I want provide two interfaces for accessing the same information is as follows.</p>
  
  <p>I’d like to have a dict-like class which uses lazy keys. E.g. <code>info["Version"]</code> should call and cache another method and transparently return the result. 
  I don’t think that works with dicts alone, therefore I need to create new methods. 
  Methods alone won’t do either, because there are some attributes which are easier to define with pure dictionary syntax.</p>
  
  <p>It probably is not the best idea anyway…</p>