About 143,000 results
Open links in new tab
  1. Python Docstrings (With Examples) - Programiz

    Python docstrings are the string literals that appear right after the definition of a function, method, class, or module. Let's take an example. Example 1: Docstrings

  2. Python Docstrings - GeeksforGeeks

    Aug 2, 2024 · Python documentation strings (or docstrings) provide a convenient way of associating documentation with Python modules, functions, classes, and methods. It’s specified in source code that is used, like a comment, to document a specific segment of code.

  3. What are the most common Python docstring formats?

    Mar 31, 2017 · There follows the main used formats for docstrings. Historically a javadoc like style was prevalent, so it was taken as a base for Epydoc (with the called Epytext format) to generate documentation. Example: This is a javadoc style.

  4. Python docstring formats (styles) and examples | note.nkmk.me

    Aug 26, 2023 · Docstring formats and example. Docstrings often contain descriptions and types of function arguments and return values. However, there is no standardized format for this. coding style - What are the most common Python docstring formats? - Stack Overflow; Here are three popular styles: reStructuredText (reST) style; NumPy style; Google style

  5. How do I document a module in Python? - Stack Overflow

    Here is an Example Google Style Python Docstrings on how module can be documented. Basically there is an information about a module, how to execute it and information about module level variables and list of ToDo items. """Example Google style docstrings. Python Style Guide`_. Docstrings may extend over multiple lines. block of indented text.

  6. Python Docstrings Tutorial : Examples & Format for Pydoc

    Feb 14, 2025 · Python documentation string, commonly known as docstring, is a string literal, and it is used in the class, module, function, or method definition. Docstrings are accessible from the doc attribute (__doc__) for any of the Python objects and also with the built-in help() function.

  7. Beginner's Guide to Python Docstrings (With Code Examples)

    Adding docstrings makes your code easier to read, maintain, and even automate! Ready to make your Python code easier for you (and everyone else) to understand? Let’s dive into the world of docstrings and level up your Python skills.

  8. Python Comments and Docstrings - Complete Guide - ZetCode

    Apr 2, 2025 · Learn to write clear, effective comments and docstrings following Python best practices. Single-line comments start with the # symbol and continue to the end of the line. They are used for brief explanations and in-line notes. This example demonstrates proper single-line comment usage.

  9. Mastering Python Docstrings: Best Practices, Styles, and Sphinx ...

    5 days ago · 6. Practical Example: Documenting Code with docstring. Using docstrings in real-world projects greatly improves code readability and makes it easier for other developers to understand and use your code. In this section, we’ll walk through how to add meaningful docstrings to classes and functions, and how to generate documentation automatically using …

  10. docstring | Python Glossary – Real Python

    Here’s an example of how you can use docstrings to document a function: def add(a, b): """Sum two numbers. Args: a (int or float): The first number. b (int or float): The second number. Returns: int or float: The sum of the two numbers. """ return a + b.

  11. Some results have been removed
Refresh