当前位置: 动力学知识库 > 问答 > 编程问答 >

python - Make sphinx's autodoc show default values in parameters' description

问题描述:

I have the following docstring:

def progress_bar(progress, length=20):

'''

Returns a textual progress bar.

>>> progress_bar(0.6)

'[##########--------]'

:param progress: Number between 0 and 1 describes the progress.

:type progress: float

:param length: The length of the progress bar in chars. Default is 20.

:type length: int

:rtype: string

'''

Is there a way to tell sphinx to add the "Default is X" part to the parameters' description if available?

网友答案:

This is not possible and must be done manually.

分享给朋友:
您可能感兴趣的文章:
随机阅读: