In comments section of PyCharm's manual there's a nice hint from developer:

#: :type: dict of (str, C)
#: :type: list of str

It works for me pretty well. Now it makes me wonder what's the best way to document parametrized classes in Python :).

Answer from Michael Korbakov on Stack Overflow
🌐
Python
peps.python.org › pep-0257
PEP 257 – Docstring Conventions | peps.python.org
The docstring for a module should generally list the classes, exceptions and functions (and any other objects) that are exported by the module, with a one-line summary of each.
🌐
Programiz
programiz.com › python-programming › docstrings
Python Docstrings (With Examples)
| | Parameters | ---------- | additional : str, optional | More info to be displayed (default is None) | | Returns | ------- | None | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) Here, we can see that the help() function retrieves the docstrings of the Person class along with the methods associated with that class. The docstrings for Python script should document the script's functions and command-line syntax as a usable message.
🌐
DataCamp
datacamp.com › tutorial › docstrings-python
Python Docstrings Tutorial : Examples & Format for Pydoc, Numpy, Sphinx Doc Strings | DataCamp
February 14, 2025 - Find different examples & format types of docstrings for Sphinx, Numpy and Pydoc. ... If you are just getting started in Python and would like to learn more, take DataCamp's Introduction to Data Science in Python course.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-docstrings
Python Docstrings - GeeksforGeeks
September 19, 2025 - Each method docstring documents parameters and return values. Proper indentation ensures readability and compatibility with tools like help(). Comments (#): Explain code but are ignored by Python at runtime.
🌐
Real Python
realpython.com › documenting-python-code
Documenting Python Code: A Complete Guide – Real Python
July 17, 2026 - All four blocks above document the same function—the same summary, the same file_loc and print_cols parameters, and the same list return—just in different syntaxes. Flip between them in the widget below to watch where each shared field lands in every format: Interactive diagram — enable JavaScript to view. Note: To learn more about docstrings and how to create them, check out How to Write Docstrings in Python.
🌐
Readthedocs
sphinxcontrib-napoleon.readthedocs.io › en › latest › example_google.html
Example Google Style Python Docstrings — napoleon 0.7 documentation
The __init__ method may be documented in either the class level docstring, or as a docstring on the __init__ method itself. Either form is acceptable, but the two should not be mixed. Choose one convention to document the __init__ method and be consistent with it. Note: Do not include the `self` parameter in the ``Args`` section. Args: param1 (str): Description of `param1`. param2 (:obj:`int`, optional): Description of `param2`. Multiple lines are supported. param3 (:obj:`list` of :obj:`str`): Description of `param3`. """ self.attr1 = param1 self.attr2 = param2 self.attr3 = param3 #: Doc comme
🌐
Real Python
realpython.com › how-to-write-docstrings-in-python
How to Write Docstrings in Python – Real Python
August 25, 2025 - They became popular through Google’s Python projects and other large codebases. To illustrate, imagine casting a spell that allows users to retrieve magical items with ease. For such a program, a Google-style docstring might look like this: ... def get_magic_items(user_id, include_potions=False): """ Retrieve a list of magical items for a specific user.
Find elsewhere
🌐
Stack Abuse
stackabuse.com › python-docstrings
Python Docstrings
August 23, 2023 - The term docstring is an abbreviation for documentation string, and describes your source code - i.e. what your function, module, or class does. It is added as a regular comment right below the head of a function, module, class, or method. A typical example looks as follows, and is taken from a Python class for working with a measurement device like a mobile sensor to measure temperature, humidity, and wind velocity. Listing 1: Python code with a single-line docstring
🌐
Python-sprints
python-sprints.github.io › pandas › guide › pandas_docstring.html
pandas docstring guide — Python documentation
In rare occasions reST styles like bold text or itallics will be used in docstrings, but is it common to have inline code, which is presented between backticks. It is considered inline code: ... Python code, a module, function, built-in, type, literal… (e.g. os, list, numpy.abs, datetime.date, True)
🌐
Lsst
developer.lsst.io › python › numpydoc.html
Documenting Python APIs with docstrings — LSST DM Developer Guide main documentation
This module demonstrates documentation written according to LSST DM's guidelines for `Documenting Python APIs with Docstrings`_. Notes ----- Docstrings have well-specified sections. This is the Notes section. Permitted sections are listed in `Numpydoc Sections in Docstrings`_.
🌐
Note.nkmk.me
note.nkmk.me › home › python
Python Docstring Formats (Styles) and Examples | note.nkmk.me
August 26, 2023 - In Python, strings written at the beginning of definitions such as functions and classes are treated as docstrings (documentation strings). IDEs or editors may offer keyboard shortcuts to display docs ...
🌐
Tutorialspoint
tutorialspoint.com › python › python_docstrings.htm
Python - Docstrings
When writing docstrings for modules, ... and list its primary components, such as list of functions, classes, and exceptions provided by the module. In this example, we demonstrate the use of docstrings for modules in Python −...
🌐
AskPython
askpython.com › python › python-docstring
Python Docstring - AskPython
February 16, 2023 - Python module docstring should list all the classes, functions, exceptions, and dependencies on other modules.
🌐
GitHub
github.com › pawamoy › mkdocstrings › issues › 135
How to handle bullet list in python docstrings · Issue #135 · mkdocstrings/mkdocstrings
July 15, 2020 - Hi! I'm trying to list something inside the docstrings of an argument of a function. For example: def fn( x: tp.Union[ jnp.ndarray, np.ndarray, tp.Mapping[str, tp.Union[np.ndarray, jnp.ndarray]], tp.Tuple[tp.Union[np.ndarray, jnp.ndarray...
Author: mkdocstrings
🌐
Readthedocs
numpydoc.readthedocs.io › en › latest › format.html
Style guide — numpydoc v1.11.1.dev1+gca74aae44 Manual
When referring to a parameter anywhere within the docstring, enclose its name in single backticks. For the parameter types, be as precise as possible. Below are a few examples of parameters and their types. Parameters ---------- filename : str copy : bool dtype : data-type iterable : iterable object shape : int or tuple of int files : list of str
🌐
Pandas
pandas.pydata.org › docs › development › contributing_docstring.html
pandas docstring guide — pandas 3.0.5 documentation
On rare occasions reST styles like bold text or italics will be used in docstrings, but is it common to have inline code, which is presented between backticks. The following are considered inline code: ... Python code, a module, function, built-in, type, literal… (e.g. os, list, numpy.abs, datetime.date, True)
🌐
Luis Llamas
luisllamas.es › home › courses › python programming course
Python Docstrings: How to Document Code
December 7, 2024 - Returns: float: The average of the numbers in the list. ''' total = sum(lst) average = total / len(lst) return average ... In this example, the docstring describes the purpose of the calculate_average function, its arguments (lst), and what it returns (float). In Python, there are several types of docstrings used for different purposes.
🌐
Dataquest
dataquest.io › home › blog › how to use python docstrings for effective code documentation
Tutorial: Documenting in Python with Docstrings
December 13, 2024 - Let's look at the different types of docstrings. First, it's an excellent idea to browse Python's PEP pages. We can find PEP 257, which summarizes Python docstrings. I strongly recommend you read it all even though you may not understand all of it.
🌐
DeepDocs
deepdocs.dev › home › 8 practical python docstring examples & patterns
8 Practical Python Docstring Examples & Patterns | DeepDocs
November 25, 2025 - As one of the most practical python docstring examples, it serves a dual purpose: it documents the code’s behavior with concrete examples and simultaneously acts as a verifiable test suite. Python’s built-in doctest module can discover and run these examples, ensuring your documentation never becomes outdated. Let’s examine a simple function for calculating an average, documented with integrated doctests. import doctest def calculate_average(numbers: list[float]) -> float: """Calculates the average of a list of numbers.