如何在单行 ReST 文档字符串中指定 return 类型并描述 return 值?

How to specify return type and describe the return value in one-line ReST docstring?

我知道我可以缩写以下 ReST 文档字符串

"""
:type flag: bool
:param flag: new value for the flag
"""

作为

"""
:param bool flag: new value for the flag
"""

我可以用类似的方式缩写以下内容吗?

"""
:rtype: bool
:returns: new value of flag
"""

这是不可能的。描述必须在 returnsreturn 中指定,return 类型在 rtype 中指定。不允许将它们合并为一行。