Python dynamic help and autocomplete generation
问题 I have almost what I want... This dynamic object encapsulating a generic function call with a dynamic docstring generation: def add_docs(tool): def desc(func): func.__doc__ = "Showing help for %s()" % tool return func return desc class Dynamic(object): def __getattr__(self, value): @add_docs(value) def mutable_f(*args, **kwargs): print "Calling:", value print "With arguments:", args, kwargs return mutable_f And it works as expected: >>> Dynamic().test(1, input='file') Calling: test With