Chris Rebert avatar Chris Rebert committed 4e182c9

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

Comments (0)

Files changed (1)

doc/ext/autodoc.rst

    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 Foo.bar.
+          #: Doc comment for class attribute Foo.bar.
           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.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.