Chris Rebert committed 4e182c9

autodoc's docstring/special-comment detection works for instance attributes too

Comments (0)

Files changed (1)


    For module data members and class attributes, documentation can either be put
    into a special-formatted comment *before* the attribute definition, or in a
    docstring *after* the definition.  This means that in the following class
-   definition, both attributes can be autodocumented::
+   definition, all attributes can be autodocumented::
       class Foo:
           """Docstring for class Foo."""
-          #: Doc comment for attribute
+          #: Doc comment for class attribute
           bar = 1
           baz = 2
-          """Docstring for attribute Foo.baz."""
+          """Docstring for class attribute Foo.baz."""
+          def __init__(self):
+              #: Doc comment for instance attribute qux.
+              self.qux = 3
+              self.spam = 4
+              """Docstring for instance attribute spam."""
    .. versionchanged:: 0.6
       :rst:dir:`autodata` and :rst:dir:`autoattribute` can now extract docstrings.