The two formats are actually the same. This can be confusing but what's called the Info field lists can be considered the reST docstring syntax. If you look carefully at the version number it's been around since Sphinx version 0.4, next if we look at the current Sphinx change list it remits to a change list that predates version 1.0... The earliest mention there is:

Release 0.4 (Jun 23, 2008)

==========================

  • Sphinx now interprets field lists with fields like :param foo: in description units.

If we want to dig further back to the definition of the reST docstring syntax the archives of the Doc-SIG - Python Documentation Special Interest Group would be the way to go, but a good enough overview is given by PEP 256 - Rationale dated 01-Jun-2001. The document that emerged from then and is most frequently cited only makes a loose recommendation:

PEP 257 -- Docstring Conventions

Python is case sensitive and the argument names can be used for keyword arguments, so the docstring should document the correct argument names. It is best to list each argument on a separate line.

To summarize things, the reST docstring syntax consists simply of using reST Field Lists! (the NumPy and Google styles are just different styles of also writing reST Field Lists)!

Field List - reStructuredText Markup Specification

Field lists are mappings from field names to field bodies,

(...)

The interpretation of individual words in a multi-word field name is up to the application. The application may specify a syntax for the field name.

Syntax diagram (simplified):

+--------------------+----------------------+
| ":" field name ":" | field body           |
+-------+------------+                      |
        | (body elements)+                  |
        +-----------------------------------+

It's up to the application to specify the syntax of the field names; so what Sphinx documentation generator specifies for the 2 example syntaxes in the question is that they are equivalent (this does not necessarily hold if you change to a different documentation generator).

Answer from bad_coder on Stack Overflow
๐ŸŒ
Readthedocs
sphinx-rtd-tutorial.readthedocs.io โ€บ en โ€บ latest โ€บ docstrings.html
Writing docstrings โ€” Sphinx-RTD-Tutorial documentation
If you are using VS code, the Python Docstring extension can be used to auto-generate a docstring snippet once a function/class has been written. If you want the extension to generate docstrings in Sphinx format, you must set the "autoDocstring.docstringFormat": "sphinx" setting, under File > Preferences > Settings...
๐ŸŒ
Sphinx
sphinx-doc.org โ€บ en โ€บ master โ€บ usage โ€บ extensions โ€บ example_google.html
Example Google Style Python Docstrings โ€” Sphinx documentation
Attributes: module_level_variable1 (int): Module level variables may be documented in either the ``Attributes`` section of the module docstring, or in an inline docstring immediately following the variable. Either form is acceptable, but the two should not be mixed. Choose one convention to document module level variables and be consistent with it. Todo: * For module TODOs * You have to also use ``sphinx.ext.todo`` extension .. _Google Python Style Guide: https://google.github.io/styleguide/pyguide.html """ module_level_variable1 = 12345 module_level_variable2 = 98765 """int: Module level variable documented inline.
๐ŸŒ
DEV Community
dev.to โ€บ cwprogram โ€บ python-documentation-with-docstrings-and-sphinx-3mom
Python Documentation With Docstrings and Sphinx - DEV Community
November 10, 2023 - This concludes a look at documentation generation via sphinx parsing python docstrings. I will say that rst is more involved than simple markdown, but it's feature rich nature makes it ideal for many forms of documentation structure.
๐ŸŒ
Medium
wbarillon.medium.com โ€บ sphinx-documentation-with-professional-standards-25e5683cb38b
Sphinx documentation with professional standards | by Will Barillon | Medium
February 12, 2026 - Just like proper nouns are capitalized to distinguish them from common words, these elements require consistent inline markup to make their role explicit to the reader - and to Sphinx. ... Docutils provides a summary of most used reStructuredText markups. There are 2 approaches regarding class docstring: set the docstring in the class, right after its declaration or in the class constructor (__init__ in Python).
๐ŸŒ
Sphinx
sphinx-doc.org โ€บ en โ€บ master โ€บ usage โ€บ extensions โ€บ autodoc.html
sphinx.ext.autodoc โ€“ Include documentation from docstrings โ€” Sphinx documentation
autodoc considers a variable member does not have any default value if its docstring contains :meta hide-value: in its Info field lists. Example: ... Added in version 3.5. Python has no built-in support for docstrings for module data members or class attributes.
Top answer
1 of 2
2

The two formats are actually the same. This can be confusing but what's called the Info field lists can be considered the reST docstring syntax. If you look carefully at the version number it's been around since Sphinx version 0.4, next if we look at the current Sphinx change list it remits to a change list that predates version 1.0... The earliest mention there is:

Release 0.4 (Jun 23, 2008)

==========================

  • Sphinx now interprets field lists with fields like :param foo: in description units.

If we want to dig further back to the definition of the reST docstring syntax the archives of the Doc-SIG - Python Documentation Special Interest Group would be the way to go, but a good enough overview is given by PEP 256 - Rationale dated 01-Jun-2001. The document that emerged from then and is most frequently cited only makes a loose recommendation:

PEP 257 -- Docstring Conventions

Python is case sensitive and the argument names can be used for keyword arguments, so the docstring should document the correct argument names. It is best to list each argument on a separate line.

To summarize things, the reST docstring syntax consists simply of using reST Field Lists! (the NumPy and Google styles are just different styles of also writing reST Field Lists)!

Field List - reStructuredText Markup Specification

Field lists are mappings from field names to field bodies,

(...)

The interpretation of individual words in a multi-word field name is up to the application. The application may specify a syntax for the field name.

Syntax diagram (simplified):

+--------------------+----------------------+
| ":" field name ":" | field body           |
+-------+------------+                      |
        | (body elements)+                  |
        +-----------------------------------+

It's up to the application to specify the syntax of the field names; so what Sphinx documentation generator specifies for the 2 example syntaxes in the question is that they are equivalent (this does not necessarily hold if you change to a different documentation generator).

2 of 2
1

Thanks to @mzjin's answer in the comments: this link describes that it is possible since v0.4.

The below example is given in the link, which is exactly what I was looking for.

py:function:: send_message(sender, recipient, message_body, [priority=1])
   """
   Send a message to a recipient

   :param str sender: The person sending the message
   :param str recipient: The recipient of the message
   :param str message_body: The body of the message
   :param priority: The priority of the message, can be a number 1-5
   :type priority: integer or None
   :return: the message id
   :rtype: int
   :raises ValueError: if the message_body exceeds 160 characters
   :raises TypeError: if the message_body is not a basestring
   """
๐ŸŒ
Lukasatkinson
lukasatkinson.de โ€บ dump โ€บ 2023-08-25-python-docstrings-sphinx
Python docstrings and Sphinx | Lukas Atkinson
August 25, 2023 - Although PEP-257 tries to set standards ... text. This is in stark contrast to Javadoc, C# XML comments, or Doxygen. Sphinx is a document processing engine primarily targeted at Python documentation....
๐ŸŒ
pytz
pythonhosted.org โ€บ an_example_pypi_project โ€บ sphinx.html
Documenting Your Project Using Sphinx โ€” an_example_pypi_project v0.0.5 documentation
You just use :members: with no arguments, then all public functions, classes, and methods are brought it that have docstring. If you explictly list the members like :members: fn0, class0, _fn1 those explict members are brought. Weโ€™ll examine these points in the full example Full Code Example.
Find elsewhere
๐ŸŒ
Medium
medium.com โ€บ quantrium-tech โ€บ write-cleaner-python-code-with-sphinx-docstrings-952c9afb6771
Writing cleaner Python code with Sphinx docstrings | by Bhargav Sridhar | Quantrium.ai | Medium
August 12, 2025 - Before diving into examples, ensure that the python docstring extension is installed in VS Code (as shown in Figure 1). This extension streamlines the process of adding structured docstrings to your functions and classes. ... To enable the Sphinx-style docstrings by default, follow these steps (illustrated in Figure 2).
๐ŸŒ
Sphinx
sphinx-doc.org โ€บ en โ€บ master โ€บ tutorial โ€บ automatic-doc-generation.html
Automatic documentation generation from code โ€” Sphinx documentation
Next, move the content of the .. py:function directive to the function docstring in the original Python file, as follows:
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ docstrings-python
Python Docstrings Tutorial : Examples & Format for Pydoc, Numpy, Sphinx Doc Strings | DataCamp
February 14, 2025 - Learn about Python Docstrings. Find different examples & format types of docstrings for Sphinx, Numpy and Pydoc.
๐ŸŒ
DEV Community
dev.to โ€บ zenulabidin โ€บ sphinx-docstring-best-practices-2fca
Sphinx Docstring Best Practices - DEV Community
September 14, 2020 - But the triple quote string immediately below one of these Python constructs is special, because it is treated like documentation. It is processed by external tools to be displayed on the help() console, and documentation generators like Sphinx. Docstrings are defined in PEP 257.
๐ŸŒ
YouTube
youtube.com โ€บ watch
Creating Documentation from Python Docstrings with Sphinx - YouTube
This video shares what I know about sphinx, it's not a lot but hopefully you find it helpful as there are a lot of pitfalls!Please refer to this website if y...
Published: June 20, 2023
๐ŸŒ
SomeBeans
ianhopkinson.org.uk โ€บ 2021 โ€บ 09 โ€บ python-documentation-with-sphinx
Python Documentation with Sphinx - Ian Hopkinson
March 10, 2025 - To do this Sphinx imports your code, and it will use the presence of the __init__.py file to discover which directories to import. It is happy to import subdirectories of the main module as submodules. These will go into files of the form module.submodule.rst. The rst files contain information from the docstrings in your code files, (those comments enclosed in triple double-quotes โ€œโ€โ€Iโ€™m a docstringโ€โ€โ€. A module or submodule will get the comments from the __init__.py file as an overview then for each code file the comments at the top of the file are included.
๐ŸŒ
Better Programming
betterprogramming.pub โ€บ 3-different-docstring-formats-for-python-d27be81e0d68
3 Different Docstring Formats for Python | by Yash Salvi | Better Programming
April 27, 2022 - Google-style tends to be easier to read for short and simple docstrings, whereas NumPy-style tends to be easier to read for long and in-depth docstrings. Nothing better than the good old sphinx docstring, this is the most basic docstring format that is used but is somewhat visually dense which makes it hard to read.
๐ŸŒ
JetBrains
jetbrains.com โ€บ pycharm โ€บ guide โ€บ tutorials โ€บ sphinx_sites โ€บ documentation
Documenting Code - JetBrains Guide
February 17, 2023 - The updated MyClass is using the Google docstring style. It also uses Python 3.6+ type hints. We now need to teach Sphinx to "interpret" these two new structures: formatted docstrings and type hints.
๐ŸŒ
Opensource.com
opensource.com โ€บ article โ€บ 19 โ€บ 11 โ€บ document-python-sphinx
How to document Python code with Sphinx | Opensource.com
November 21, 2019 - ... Yuko Honda on Flickr. CC BY-SA 2.0 ยท Python code can include documentation right inside its source code. The default way of doing so relies on docstrings, which are defined in a triple quote format.
๐ŸŒ
Sphinx
sphinx-doc.org
Sphinx โ€” Sphinx documentation
Generate API documentation for Python, C++ and other software domains, manually or automatically from docstrings, ensuring your code documentation stays up-to-date with minimal effort.