A
A
Alexander2014-06-28 11:58:28
Python
Alexander, 2014-06-28 11:58:28

How do I set the description of a module constant in PyCharm so that it is displayed in the Ctrl+Q quick documentation?

I have a separate module in the project, which contains all sorts of settings. For example, there is a constant AREA_CM2_PER_CM3_OF_PAINT. I really want to somehow describe in more detail in her own docstring. How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav Pukhanov, 2014-07-03
@Survtur

Generally speaking, the language does not have docstring support for variables.
However, there are the following options for documenting documents:

  1. For class member variables:
    class A:
        x = 22
        """Docstring for class variable A.x"""
    
        def __init__(self, a):
            self.y = a
            """Docstring for instance variable A.y"""

  2. For any variables:
    #: docstring for x
    x = 22
    x = 22 #: docstring for x

    I don’t know if they are accepted by PyCharm, because I didn’t deal with docstrings for constants myself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question