title: python __getattr__ autocompletion
body: <p><code>__getattr__</code> can be used to define attributes of objects. E.g. the following code will return <code>'bar'</code>.</p>
  
  <pre><code>class Test(object):
      def __getattr__(self, key):
          if key == 'foo':
              return 'bar'
  t = Test()
  t.foo
  </code></pre>
  
  <p>To make life a bit easier I would like be able to type <code>t.</code> in ipython and then tab-complete the attribute name. I don't seem to be able to find how this can be done, while it seems to be possible. E.g. run the following code in ipython</p>
  
  <pre><code>import pandas
  df = pandas.DataFrame(data={'foo': ('bar',)})
  </code></pre>
  
  <p>Typing <code>df.</code> and tab-completing allows to select the <code>foo</code> option. I could not find how pandas does this in its code, so I'm asking here. What should I add to my <code>Test</code> class such that tab-completion will work?</p>