如何为在 PyCharm 快速文档功能中可见的 Python 变量创建文档? [英] How to create documentation for Python variables that will be visible in PyCharm quick documentation functionality?
问题描述
我有一个名为 PushButtonType.py
的文件,我在其中定义了两个变量:
OK = 0 # 就像一个 OK 按钮.""" 就像一个取消按钮."""取消 = 0
在另一个文件中,我导入并使用这些变量:
from PushButtonType import CANCEL, OKfoo = 取消酒吧 = 好
我希望第一个文件中的注释在 PyCharm 的快速文档 (Ctrl+Q) 功能中可见.目前,当我将光标放在一个变量上并按 Ctrl+Q 时,我会收到一条消息,指出未找到文档"(请参见下面的屏幕截图).
我希望评论在快速文档弹出窗口中可见.我怎样才能做到这一点?有什么特殊的评论格式吗?
With
I have a file named PushButtonType.py
where I define two variables:
OK = 0 # acts like a OK button.
""" acts like a cancel button. """
CANCEL = 0
In another file, I import and use those variables:
from PushButtonType import CANCEL, OK
foo = CANCEL
bar = OK
I want the comments from the first file to be visible in the Quick Documentation (Ctrl+Q) functionality of PyCharm. Currently, when I put a cursor on one of the variables and press Ctrl+Q, I get a message saying "No documentation found" (see screenshot below).
I would like the comments be visible in the Quick documentation popup. How can I do this? Is there some special format of comments?
With 2018.2 EAP:
bar = 1
"""bar variable"""
这篇关于如何为在 PyCharm 快速文档功能中可见的 Python 变量创建文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!