【发布时间】:2011-08-01 17:43:23
【问题描述】:
默认情况下,Sphinx 不会为 __init__(self) 生成文档。我尝试了以下方法:
.. automodule:: mymodule
:members:
和
..autoclass:: MyClass
:members:
在 conf.py 中,设置以下内容仅将 __init__(self) 文档字符串附加到类文档字符串(the Sphinx autodoc documentation 似乎同意这是预期的行为,但没有提及我要解决的问题) :
autoclass_content = 'both'
【问题讨论】:
-
不,这不是今天的文档所写的,至少:
"both" Both the class’ and the __init__ method’s docstring are concatenated and inserted.-> 因此,它不应该只是__init__(self),还应该是类文档字符串,如果你有的话那。你能提供一个测试用例吗,因为如果是这样,那感觉就像一个错误,对吧?
标签: python python-sphinx autodoc