Runtime Inspection Modules

reprlib

Produces abbreviated representations for large or deeply nested objects. Repr lets you set limits by type; recursive_repr decorates custom __repr__ methods to avoid recursion. Abbreviated text is for diagnostics and can omit important data.

Formal Syntax & Structure

python syntaxpython
import reprlib

Return Value

module

Module namespace available through import; import is a statement, not a value-returning expression.

Working Example

Example Snippetpython
from reprlib import Reprshort = Repr()short.maxlist = 2print(short.repr([1, 2, 3, 4]))
Python Reference