Documentation of a property in the python interpreter using help works fine for me, see proprerty documentation. Note: IPython's magic help operator, ?
, did not display the property docstring.
>>> class foo(object):
>>> def __init__(self, bar):
>>> self._bar = bar
>>> @property
>>> def bar(self):
>>> """bar property"""
>>> return self._bar
>>> help(foo.bar)
Help on property:
bar property
In Sphinx you must use the :members:
directive to document properties, see autodoc documentation. Works like a charm for me!
Attributes will also be documented by Sphinx if :members:
is used. Docstrings for attributes can be given as comments preceding the attribute, but using a colon following the hash mark, EG #: the foo attribute
. From the Sphinx autodoc documentation:
For module data members and class attributes, documentation can either be put into a comment with special formatting (using a #: to start the comment instead of just #), or in a docstring after the definition. Comments need to be either on a line of their own before the definition, or immediately after the assignment on the same line. The latter form is restricted to one line only.