def myfunc(p1, p2, p3):
"""myfunc does something interesting.
some more detail. See :meth:`my_other_func` for more information.
:param p1: The first parameter.
:type p1: string
:param p2: The second parameter.
:param p3: The third parameter.
:returns: True if successful, False if not.
"""
my_code(p1)
more_code(p2)
return third_part(p1,p2,p3)
我在Django和纯Python项目中广泛使用inteljidea/PyCharm。在
正确的方法是使用reStructuredText和Sphinx,后者只有在您想要生成HTML或PDF文档时才可以使用。这也是Python库本身的记录方式。几个月前,我从epydoc切换到reStructuredText,因为后者得到了更好的总体支持。在
您的docstring将如下所示:
对于基本元素,它与旧的epydoc标准没有太大区别。PyCharm能够解析这些信息,例如在函数体中使用:type:specs来完成。在
如PyCharm webhelp on supported docstring formats中所述,您将有三个选项:
相关问题 更多 >
编程相关推荐