【发布时间】:2012-06-23 08:58:10
【问题描述】:
我想在 Python 文档字符串的其他地方引用以前记录的函数参数。考虑以下(诚然完全人为的)示例:
def foo(bar):
"""Perform foo action
:param bar: The bar parameter
"""
def nested():
"""Some nested function that depends on enclosing scope's bar parameter.
I'd like to reference function foo's bar parameter here
with a link, is that possible?"""
return bar * bar
# ...
return nested()
有没有一种使用 Sphinx 标记嵌入参数引用的简单方法,或者这会自动发生吗?
(我是一个完整的 Sphinx 新手。我一直在扫描 Sphinx 文档,但没有找到这个问题的答案,也没有找到演示正确标记的示例。)
【问题讨论】:
标签: python python-sphinx docstring