How to create documentation for Python variables t

2019-07-17 02:17发布

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?

Quick documentation popup in PyCharm

1条回答
Melony?
2楼-- · 2019-07-17 02:35

With 2018.2 EAP:

bar = 1
"""bar variable"""

enter image description here

查看更多
登录 后发表回答