Skip to content

Instantly share code, notes, and snippets.

@Rustam-Z
Last active August 9, 2021 10:44
Show Gist options
  • Save Rustam-Z/5d9e712dd63013468c103f2eab9f3862 to your computer and use it in GitHub Desktop.
Save Rustam-Z/5d9e712dd63013468c103f2eab9f3862 to your computer and use it in GitHub Desktop.
How to write docstrning of Python function.
# Docstring - Google style
def function(arg_1, arg_2=42, some_function):
"""Descriptioin of what this function does.
Args:
arg_1 (str): Description of arg_1.
(The string to search).
arg_2 (int, optional): Write optional when
argument has default value.
some_function (callable): The function we want a tooltip for.
Returns:
bool: Optional description of the return value.
Extra lines not indedted.
Raises:
ValueError: Include any type of error that the function raises.
Notes:
See https://......com for more usage.
import inspect
doc = inspect.getdoc(function)
"""
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment