---
source: https://iinventedlight.com/library/notes/python-reprlib.md
title: "Python reprlib: size-limited object representations"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, reprlib — Alternate repr() implementation; CPython, reprlib documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-24
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-24
as_of: 2026-11-24
confidence: medium
untested: "Not reproduced (2026-11-24). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-reprlib"
tags: [python, reprlib, repr, debugging, strings]
client: Librarian
sources:
  - id: S1
    title: "reprlib — Alternate repr() implementation"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/reprlib.html
    accessed: 2026-11-24
    license: "PSF License Version 2"
  - id: S2
    title: "reprlib documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/reprlib.rst
    accessed: 2026-11-24
    license: "PSF License Version 2"
---
# Python reprlib: size-limited object representations
**Answer:** reprlib produces object representations with limits on the size of the resulting strings.

## What the module provides

It is used in the Python debugger and may be useful in other contexts.

The module provides a class, an instance, and a function.

The Repr class adds size limits for different object types so representations do not run on too long.

Constructor keyword arguments set attributes on a Repr instance.

## Limits, placeholders, and recursion

Default limits include maxlevel 6, maxlist 6, and maxstring 30.

The constructor can set fillvalue as a shortcut for a Repr attribute.

A recursive_repr decorator can detect recursive calls to a custom representation method and substitute a placeholder.

## See also

- [python-pprint](https://iinventedlight.com/library/notes/python-pprint/)
- [python-string](https://iinventedlight.com/library/notes/python-string/)
- [python-copy](https://iinventedlight.com/library/notes/python-copy/)

## Claims

- id: C1
  claim: reprlib can produce object representations with size limits.
  source: S1
  evidence: "producing object representations with limits on the size of the resulting strings"

- id: C2
  claim: The module provides a class, an instance, and a function.
  source: S1
  evidence: "This module provides a class, an instance, and a function"

- id: C3
  claim: reprlib can produce object representations with size limits.
  source: S2
  evidence: "producing object representations with limits on the size of the resulting strings"

- id: C4
  claim: The module provides a class, an instance, and a function.
  source: S2
  evidence: "This module provides a class, an instance, and a function"

## Sources

- [S1] reprlib — Alternate repr() implementation. Python Software Foundation. https://docs.python.org/3/library/reprlib.html . License: PSF License Version 2. Accessed 2026-11-24.

- [S2] reprlib documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/reprlib.rst . License: PSF License Version 2. Accessed 2026-11-24.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, reprlib — Alternate repr() implementation; CPython, reprlib documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
