Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 什么';这些格式在twisted';什么是文件串?_Python_Format_Twisted_Docstring - Fatal编程技术网

Python 什么';这些格式在twisted';什么是文件串?

Python 什么';这些格式在twisted';什么是文件串?,python,format,twisted,docstring,Python,Format,Twisted,Docstring,在twisted的源代码中,许多docstring包含如下格式:L{xxx}或C{xxx}或以“@”开头的行,它们的含义是什么 例如,在twisted/internet/interface.py中: def registerProducer(producer, streaming): """ Register to receive data from a producer. ... For L{IPullProducer} providers, C{resumeP

在twisted的源代码中,许多docstring包含如下格式:L{xxx}或C{xxx}或以“@”开头的行,它们的含义是什么

例如,在twisted/internet/interface.py中:

def registerProducer(producer, streaming):
    """
    Register to receive data from a producer.
    ...
    For L{IPullProducer} providers, C{resumeProducing} will be called once
    each time data is required.
    ...
    @type producer: L{IProducer} provider
    ...
    @return: C{None}
    """
L{IPullProducer},C{resumeProducing},@type producer?


顺便问一下,这些格式是标准python文档字符串格式的一部分吗?如果有的话,我应该提到哪里?谢谢:)

Twisted使用的文档格式是

L{}
表示“链接”(即“这是一个Python标识符,请链接到它”)
C{}
表示“代码”(即
hello C{foo}条
的格式应类似于“hello
foo
bar”)
I{}
只是“斜体”的意思。您可以在epytext文档中看到更多字段

Twisted项目使用调用(如
pydoctor--add package Twisted
)生成文档。还有一点,生成到Twisted所依赖的几个其他项目的链接,但是如果您想为Twisted贡献docstring,您可以使用它来获得想法。您还可以使用epydoc本身生成文档,使用
epydoc twisted
,但epydoc不知道Zope接口,因此不会自动将类链接到它们实现的接口

,你可以在那里浏览