title: Python: Making a read-only property accessible via **vars(some_class)
body: <p>I often use the idiom <code>'{var_name}'.format(**vars(some_class))</code>.</p>
  
  <p>However, when I use a property, I cannot use this to get the properties value.</p>
  
  <p>Consider this program:</p>
  
  <pre><code>#!/usr/bin/env python
  
  class Foo(object):
      def __init__(self):
          self._bar = None
          self.baz = 'baz here'
  
      @property
      def bar(self):
          if not self._bar:
              # calculate some value...
              self._bar = 'bar here'
          return self._bar
  
  if __name__ == '__main__':
      foo = Foo()
  
      # works:
      print('{baz}'.format(**vars(foo)))
  
      # gives: KeyError: 'bar'
      print('{bar}'.format(**vars(foo)))
  </code></pre>
  
  <p><strong>Question:</strong></p>
  
  <p>Is there a way to make a properties value accessible via <code>**vars(some_class)</code>?</p>