reprlib.recursive_repr()
reprlib.recursive_repr() is a Python function in the Reprlib Module category. A decorator for __repr__ methods to handle recursive objects. The syntax is reprlib.recursive_repr(fillvalue="..."). Returns: Decorator. A typical example: class Node:
def __init__(self, next=None):
self.next = next
@reprlib.recursive_repr()
def __repr__(self):
return f"Node({self.next!r})". A close sibling is reprlib.repr(), which returns a string representation with controlled length limits (for large/deep objects). More about this category: Custom repr with size limits — repr, recursive_repr. Related Reprlib Module entries: reprlib.repr(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try reprlib.recursive_repr() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.