【问题标题】:Change reStructuredText format in PyCharm for auto-generated comments在 PyCharm 中更改 reStructuredText 格式以获取自动生成的评论
【发布时间】:2017-10-10 06:32:23
【问题描述】:

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)

曾经有一种方法,您可以如何选择生成 cmets 的一种或另一种方法,但我在 PyCharm 2017.1.2 中找不到该设置了。有什么想法,这个设置去哪儿了?

我希望在同一行中包含类型描述 param_type,但标准方式将其放在下一行。

【问题讨论】:

  • 有没有办法把类型和参数放在同一行?我也在找。

标签: python pycharm restructuredtext type-hinting docstring


【解决方案1】:

它在设置 -> 工具 -> Python 集成工具 -> 文档字符串 -> 文档字符串格式中。

如果我理解正确,您所追求的格式是 NumPy 格式。

另外,如果您使用的是 Python>=3.5,您可能已经知道变量和函数参数中的类型提示,它们看起来非常整洁并节省了文档字符串中的空间:https://docs.python.org/3/library/typing.html

Sphinx 通过以下方式之一支持它们:

【讨论】:

    猜你喜欢
    • 2011-12-01
    • 2011-06-15
    • 2013-02-03
    • 1970-01-01
    • 1970-01-01
    • 2014-07-30
    • 1970-01-01
    • 2012-06-05
    • 2019-03-29
    相关资源
    最近更新 更多