docstring Questions

4

Solved

I have a function in python 3.x def foo(): """Lorem ipsum for more info, see here"" I want to add a hyperlink to 'here' to point to a web site. How can I do that without i...
Quinte asked 22/7, 2022 at 3:38

1

Python 3.12 has the type statement. How do I document the type alias properly? I tried: type Number = int | float """Represents a scalar number that is either an integer or float&quo...
Iconology asked 3/12, 2023 at 21:45

3

I am using VS Code as my editor and autoDocstring as the auto-docstring generator extension for Python. There are times when I modify the parameters of a function, either by introducing new paramet...
Dzoba asked 30/4, 2022 at 2:42

2

Solved

I was building a documentation site for my python project using mkdocstrings. For generating the code referece files I followed this instructions https://mkdocstrings.github.io/recipes/ I get these...
Geraldina asked 24/1, 2023 at 20:35

3

Solved

Is it possible to have a Python docstring calculated? I have a lot of repetitive things in my docstrings, so I'd like to either use f-strings or a %-style format expression. When I use an f-string ...
Goldfilled asked 26/1, 2022 at 12:38

4

I currently have installed VS Code as an alternative editor to Jupyterlab for Python Data Science development. Now I am wondering about how to show the docstring or signature of a function? I did...
Elboa asked 13/2, 2020 at 8:58

5

Solved

How do I transcode Python documentation strings to a GitHub readme.md file? Even though it seems like something everyone does, I cannot seem to get a decent solution and I am assuming it should be ...
Outhaul asked 26/3, 2016 at 16:3

18

Solved

Pylint throws errors that some of the files are missing docstrings. I try and add docstrings to each class, method and function, but it seems that Pylint also checks that files should have a docstr...
Marigolde asked 24/10, 2011 at 14:51

5

Solved

I'm writing a lightweight class whose attributes are intended to be publicly accessible, and only sometimes overridden in specific instantiations. There's no provision in the Python language for cr...
Acicular asked 16/6, 2010 at 6:58

11

Solved

Is it possible to add a documentation string to a namedtuple in an easy manner? I tried from collections import namedtuple Point = namedtuple("Point", ["x", "y"]) """ A point in 2D space """ # ...
Muncy asked 22/10, 2009 at 10:55

5

Solved

I'm using the pygame module on VS Code and I ran into the issue where the pygame has not init member. I followed the solutions to this link. I edited the user settings and added "python.lintin...
Dubuffet asked 29/1, 2021 at 5:36

3

Is there a tool that can check if the arguments listed in the docstring match the signature of the function call? It should be able to deal with numpy-style docstrings. I am regularly using R CMD C...

2

Solved

I'm looking to copy the docstring of a function in the same file by name (with a decorator). I can easily do it with a function that is out of the current module, but I'm a bit confused when it com...
Orville asked 24/8, 2021 at 2:23

4

Solved

I was just wondering what is the difference between two ways of writing Python Docstrings (__doc__): three single quotes: ''' Comment goes here ''' three double quotes: """ Comment goes here ...
Undeviating asked 26/10, 2012 at 5:22

2

Solved

I'm currently writing documentation for my python package using Sphinx and the autodoc plugin. For a function return value I can e.g. write :returns: int: count which tells sphinx that there is a ...
Ellord asked 10/7, 2017 at 6:1

3

I have a python file that has raw strings as the docstrings. def a(): '\n\tthis\n\tis\n\tthe docstring.\n\t' print 'hello world' how would I rewrite the docstring to look like def a(): """ ...
Tomchay asked 15/7, 2014 at 20:40

4

Solved

I use the PyCharm IDE which assists with crafting PEP0257-compliant docstrings. It provides two attributes I don't entirely understand the distinction/use between: :raise Exception: exception exp...
Clatter asked 8/12, 2015 at 16:25

4

Solved

What is the preferred way to write Python doc string? """ or " In the book Dive Into Python, the author provides the following example: def buildConnectionString(params): ...
Microtone asked 14/7, 2013 at 21:22

8

Solved

I want to print the docstring of a python function from inside the function itself. for eg. def my_function(self): """Doc string for my function.""" # print the Docstring here. At the moment I...
Snowdrop asked 11/1, 2012 at 16:17

1

Solved

I've been looking all over the web for the current standards for Python Docstrings and I've come across different answers for different scenarios. What is the currently most-accepted and wide...
Granddad asked 2/12, 2022 at 11:33

1

Solved

I am using mkdocs with the mkdocstrings plugin to generate the documentation of my Python package. My package is organized in a standard fashion - setup.py - mkdocs.yaml - docs/ - mypackage/ - __i...
Cecilla asked 26/10, 2022 at 14:4

1

As this post describes, autodoc will eagerly add the class variables to the documentation even if napoleon adds the fields as documentation in: from dataclasses import dataclass @dataclass class Fo...
Xerography asked 17/1, 2022 at 8:1

2

Solved

Goal: generate docstring in vscode for Python automatically and format the generated docstring to my liking. Solution: I installed the autoDocstring extension. Problem: I don't know how to get th...
Riess asked 6/8, 2018 at 22:29

7

I'm trying to do some class inheritance in Python. I'd like each class and inherited class to have good docstrings. So I think for the inherited class, I'd like it to: inherit the base class docs...
Cryptonym asked 8/1, 2010 at 4:45

2

Solved

Does anyone now a simple way do convert all docstrings in an existing project from reStructured Text to the Google format? It looks like Napoleon can do something like that, but it looks very comp...

© 2022 - 2025 — McMap. All rights reserved.