This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author abhik
Recipients abhik, georg.brandl
Date 2008-04-30.14:03:07
SpamBayes Score 0.0039411047
Marked as misclassified No
Message-id <1209564254.38.0.0869277765.issue2726@psf.upfronthosting.co.za>
In-reply-to
Content
The autoclass directive adds the class constructor's argspec to the header and shows the class docstring 
below it but doesn't add the constructor's docstring.  I usually use the class docstring to describe the 
class and the constructor's docstring to describe the constructor arguments so if the constructor argspec 
is being shown, I would expect the description of it to be included below.

Result of svn diff sphinx/ext/autodoc.py:

Index: sphinx/ext/autodoc.py
===================================================================
--- sphinx/ext/autodoc.py	(revision 62582)
+++ sphinx/ext/autodoc.py	(working copy)
@@ -154,6 +154,13 @@
     result.append(indent + '.. %s:: %s%s' % (what, qualname, args), '<autodoc>')
     result.append('', '<autodoc>')
 
+    # added by abhik (4/29/08)
+    if what == 'class':
+        initdoc = inspect.getdoc(getattr(todoc, '__init__'))
+        if initdoc:
+            docstring = docstring if docstring else ''
+            docstring += "\n" + indent + initdoc
+
     # the module directive doesn't like content
     if what != 'module':
         indent += '   '


I don't know how other people would expect autodoc to work so maybe this behavior could be controlled by 
a config param?
History
Date User Action Args
2008-04-30 14:04:34abhiksetspambayes_score: 0.0039411 -> 0.0039411047
recipients: + abhik, georg.brandl
2008-04-30 14:04:15abhiksetspambayes_score: 0.0039411 -> 0.0039411
messageid: <1209564254.38.0.0869277765.issue2726@psf.upfronthosting.co.za>
2008-04-30 14:04:08abhiklinkissue2726 messages
2008-04-30 14:03:48abhikcreate