They are actually quite easy to get to. help() on both the class or instance produces the docstring, and __doc__ on the property as accessed from the class produces the docstring.
>>> class Test(object): ... @property ... def fred(self): ... """*This is a docstring.*""" ... return 1 ... >>> help(Test) Help on class Test in module __main__: class Test(__builtin__.object) | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | fred | *This is a docstring.* >>> Test.fred.__doc__ '*This is a docstring*.' >>> t = Test() >>> t.fred.__doc__ 'int(x[, base]) -> integer\n\n...' >>> help(t) Help on Test in module __main__ object: class Test(__builtin__.object) | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | fred | *This is a docstring.* Chris On Mon, Aug 8, 2011 at 12:05 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > Ethan Furman wrote: > > > So if property docstrings are so hard to get to, what's the point in > > having them? > > Hard to get, not impossible. But I have no idea really -- they don't seem > very useful to me. > > > > -- > Steven > > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list