我正在学习如何使用Sphinx为我的代码创建文档。在我看到一些这样的例子之后:
def complex(real=0.0, imag=0.0):
"""Form a complex number.
Keyword arguments:
real -- the real part (default 0.0)
imag -- the imaginary part (default 0.0)
"""
if imag == 0.0 and real == 0.0: return complex_zero
...
评论中使用什么语言让 Sphinx 理解并抓住它们?如果没有这种语法和逻辑,Sphinx 在我的代码中看不到注释,并且当我生成 HTML 时,模块是空的。
这里有一个例子: