On Sat, 02 May 2009 23:36:26 -0500, Kevin D. Smith wrote: > I have a simple descriptor to create a cached property as shown below. ... > What do I need to do to get the doc string of the wrapped function to > apper when using help()?
Call it on the class, not the instance: >>> class Test(object): ... def getx(self): return "spam" ... def setx(self, value): return None # and do nothing ... x = property(getx, setx, None, "This is my docstring") ... >>> t = Test() >>> t.x.__doc__ # like "spam".__doc__ 'str(object) -> string\n\nReturn a nice string representation of the object.\nIf the argument is a string, the return value is the same object.' >>> Test.x.__doc__ 'This is my docstring' -- Steven -- http://mail.python.org/mailman/listinfo/python-list