python 文档字符串中的这些标签@ivar @param 和@type 是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/379346/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 19:59:31  来源:igfitidea点击:

What are these tags @ivar @param and @type in python docstring?

pythondocumentationjavadoc

提问by Andrea Francia

The ampoule project uses some tags in docstring, like the javadoc ones.

安瓿项目在 docstring 中使用了一些标签,比如 javadoc 中的标签。

For example from pool.pyline 86:

例如来自pool.py第 86 行:

def start(self, ampChild=None):
    """
    Starts the ProcessPool with a given child protocol.

    @param ampChild: a L{ampoule.child.AMPChild} subclass.
    @type ampChild: L{ampoule.child.AMPChild} subclass
    """

What are these tags, which tool uses it.

这些标签是什么,哪个工具使用它。

采纳答案by S.Lott

Markup for a documentation tool, probably epydoc.

文档工具的标记,可能是epydoc

回答by cdleary

Just for fun I'll note that the Python standard library is using Sphinx/reStructuredText, whose info field listsare similar.

只是为了好玩,我会注意到 Python 标准库使用的是 Sphinx/reStructuredText,其信息字段列表是相似的。

def start(self, ampChild=None):
    """Starts the ProcessPool with a given child protocol.

    :param ampChild: a :class:`ampoule.child.AMPChild` subclass.
    :type ampChild: :class:`ampoule.child.AMPChild` subclass
    """