About 432,000 results
Open links in new tab
  1. How to write help/description text for Python functions

    Dec 13, 2019 · I have to write many functions and was wondering how I can incorporate a help or description text such that it appears in the object inspector of spyder when I call the function. In MatLab, this worked by putting commented text at the beginning of the function file.

  2. Python Docstrings - GeeksforGeeks

    Aug 2, 2024 · The str() function in Python is an in-built function that takes an object as input and returns its string representation. It can be used to convert various data types into strings, which can then be used for printing, concatenation, and formatting.

  3. python - How to document a method with parameter(s ... - Stack Overflow

    from typing import Dict, Union def foo(i: int, d: Dict[str, Union[str, int]]) -> int: """ Explanation: this function takes two arguments: `i` and `d`. `i` is annotated simply as `int`. `d` is a dictionary with `str` keys and values that can be either `str` or `int`.

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

    Aug 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 docstrings for easy reference.

  5. Multi-line description of a parameter description in python docstring

    Sep 14, 2015 · So, reStructuredText is the recommended way for Python code documentation, if you try hard enough, you can find in the sphinx documentation how to normalize your function signature documentation. All given examples are single-line, but what if a parameter description is multi-line like the following ?

  6. 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. Here, the string literal: '''Take a number n and return the square of n.''' Inside the triple quotation marks is the docstring of the function square() as it appears right after its definition.

  7. 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.

  8. Python Function Docstrings - Python Tutorial

    You'll learn how to use Python function docstrings to add documentation to functions and use the help function to retrieve it.

  9. Doc-Strings in python: A Comprehensive Guide - Matics Academy

    What are Doc-Strings in python? A Doc-String in python (short for documentation string) is a string literal used to describe a module, class, function, or method in Python. It serves as an inline documentation mechanism, allowing developers to explain the purpose and usage of their code directly within the code base.

  10. How to Document Functions in Python - codingem.com

    To document functions in Python, use docstrings (triple quotation marks). For example: """ Greets a person with their name. But why is this better than a regular comment with #? It is because you can then call the help () function on a method to see …

  11. Some results have been removed
Refresh