How to create documentation for Python variables that will be visible in PyCharm quick documentation functionality?

一个人想着一个人 提交于 2020-01-15 04:02:07

问题


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?


回答1:


With 2018.2 EAP:

bar = 1
"""bar variable"""



来源:https://stackoverflow.com/questions/51408379/how-to-create-documentation-for-python-variables-that-will-be-visible-in-pycharm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!