That has nothing to do with IPython, IPython just reads the __doc__
attribute of an object. If you dynamically create your objects in the __getattr__
method you should just set their __doc__
attribute as well and everything will work correctly in IPython.
Here is an example:
class A(object):
def __init__(self, name):
self.name = name
def __repr__(self):
return 'A[%s]' % self.name
class Test(object):
def __getattr__(self, name):
a = A(name)
a.__doc__ = 'My a documentation'
return a
In [11]: t = Test()
In [12]: t.foo
A[foo]
In [13]: t.foo?
Type: A
String Form:A[foo]
Docstring: My a documentation