PyCharm 2026.3 Help

Create documentation comments

Creating documentation comments for Python functions

To create a documentation comment for a Python function

  1. Place the caret after the declaration of a function you want to document.

  2. Type opening triple quotes, and press Enter, or Space.

  3. Add meaningful description of parameters and return values.

To create documentation comment for a Python function using intention action

  1. Place the caret at the name of a function that does not have a docstring yet.

  2. Press Alt+Enter to show the available intention actions.

  3. Choose Insert a documentation string stub:

    Intention actions for a Python function with Insert a documentation string stub selected and docstring type actions below it

    PyCharm generates documentation comment stub according to docstring format, selected in the Python Integrated Tools page.

Example of a Python documentation comment

Consider the following function:

def handle(self, myParam1, myParam2):

Open settings Ctrl+Alt+S and navigate to Python | Tools | Integrated Tools.

In the Docstring format dropdown, select reStructuredText.

Then type the opening triple double-quotes and press Enter or Space. PyCharm generates a documentation comment stub in reStructuredText format:

""" :param self: :param myParam1: :param myParam2: :return: """

You can use markup for text formatting, as well as substitutions, bulleted lists, links, code blocks, and tables.

14 October 2026