Runtime Data Attributes

function.__doc__

Function documentation from its initial string literal, normally None when absent. Metadata can be replaced without changing execution.

Formal Syntax & Structure

python syntaxpython
f.__doc__

Return Value

str | None

Usual metadata value under ordinary construction; manually assigned metadata can differ. See description.

Working Example

Example Snippetpython
def f():    "Read a value."    return 7print(f.__doc__)
Python Reference