title: How to write getatrribute so that variables in dict can be returned?
body: <p>I have a class, and there is a dict in it. I want to visit variables in the dict by direct "instance.key" instead of "instance.d[key]". How to do that?</p>
  
  <pre class="lang-py prettyprint-override"><code>class A:
      def __init__(self):
          self.a = 1
          self.b = 2
          self.fields = {'c': 3, 'd': 4}
  
  
  def main():
      a = A()
      print(a.a) # 1
      print(a.b) # 2
      print(a.c) # currently raise Exception, I want it to print 3
      print(a.d) # currently raise Exception, I want it to print 4
  
  
  if __name__ == '__main__':
      main()
  </code></pre>