JetBrains的文档说,创建reStructuredText comments with type-hinting有两种格式:
:param param_type param_name: parameter description (type description is on the same line as the parameter description).
:type param_name: param_type (type description is on a separate line)
以前有一种方法,如何选择一种或另一种方式如何生成注释,但我无法在PyCharm 2017.1.2中找到该设置。任何想法,这个设置去了哪里?
我希望在同一行中有类型描述param_type
,但标准方式将它放在下一行。
它位于设置 - >工具 - > Python集成工具 - >文档字符串 - >文档字符串格式。
如果我理解正确的格式你就是NumPy格式。
此外,如果您使用的是Python> = 3.5,您可能已经知道变量和函数参数中的类型提示,它们看起来非常整洁并且在文档字符串中节省了空间:https://docs.python.org/3/library/typing.html
并且sphinx支持他们之一: