更改PyCharm中自动生成的注释的RestructedText格式

2024-06-08 02:03:35 发布

您现在位置:Python中文网/ 问答频道 /正文

来自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,但标准方法是将其放在下一行中。在


Tags: the方法name文档parameterparamison
1条回答
网友
1楼 · 发布于 2024-06-08 02:03:35

它位于设置->工具->Python集成工具->Docstrings->Docstring格式中。在

enter image description here

如果我没弄错的话,你要的格式是最新的。在

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

狮身人面像用一种:

相关问题 更多 >

    热门问题