title: Getting all attributes to appear on python's `__dict__` method
body: <p>Please consider the following python example:</p>
  
  <pre><code>In [3]: class test(object):
     ...:     attribute='3'
     ...:     def __init__(self):
     ...:         self.other='4'
     ...:         
  
  In [4]: b=test()
  
  In [5]: b.attribute
  Out[5]: '3'
  
  In [6]: b.__dict__
  Out[6]: {'other': '4'}
  </code></pre>
  
  <p>Why is it that <code>__dict__</code> only shows the <code>"other"</code> attribute and not <code>"atribute"</code>?</p>
  
  <p>And how do I get a dictionary with all the classe's attributes and values? That is, how do I get this?</p>
  
  <pre><code>{'other': '4', 'attribute': '3'}
  </code></pre>
  
  <p>And I mean by using <code>__dict__</code> or by some other simple means.</p>
  
  <p>PS: related to <a href="https://stackoverflow.com/questions/9058305/getting-attributes-of-a-class">this question</a>, but couldn't quite get a dict from there.</p>
  
  <p>PS2: I'm not look for <code>test.__dict__</code> or <code>b.__class__.__dict__</code>, I'm looking for something that can be used as</p>
  
  <pre><code>In [3]: class test(object):
     ...:     attribute='3'
     ...:     def __init__(self):
     ...:         self.other='4'
     ...:     def _print_atr(self):
     ...:         # This should print exactly {'other': '4', 'attribute': '3'}
     ...:         print(self.__all_atr__)
  
  In [4]: b=test()
  
  In [5]: b.attribute
  Out[5]: '3'
  
  In [6]: b.__dict__
  Out[6]: {'other': '4'}
  </code></pre>
  
  <p>Cheers</p>