title: Python Object with @property's to dict
body: <p>I'm new to Python so please excuse if I've glazed over something simple to do this.</p>
  
  <p>I have an object like this:</p>
  
  <pre><code>class myObject(object):
      def __init__(self):
          self.attr1 = None
          self.attr2 = None
  
      @property
      def prop1(self):
          return foo.some_func(self.attr1)
  </code></pre>
  
  <p>And I instantiate it like this:</p>
  
  <pre><code>a = myObject()
  a.attr1 = 'Apple'
  a.attr2 = 'Banana'
  </code></pre>
  
  <p>And the method it's all wrapped in expects a return of dict, so I do this:</p>
  
  <pre><code>return a.__dict__
  </code></pre>
  
  <p>but <code>prop1</code> is not included in the return. I understand why this is, it's not in the object's <code>__dict__</code> because it only holds real attributes.</p>
  
  <p>So the question is, how can I make my return, return something like this:</p>
  
  <pre><code>{'attr1': 'Apple', 'attr2': 'Banana', 'prop1': 'ModifiedApple'}
  </code></pre>
  
  <p>other than right before the return doing:</p>
  
  <pre><code>a.prop1_1 = a.prop1
  </code></pre>