On this page
  1. pprint.saferepr
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

pprint.saferepr

Prev: pprint.PrettyPrinter | Up: pprint
Rel: pprint.isreadable, pprint.isrecursive, pprint.pformat, pprint.pp
Ref: docs.python.org — pprint.saferepr
Tags: #public #python3 #stdlib #pprint


Import

import pprint
from pprint import saferepr

Signature & Overview

pprint.saferepr(object)

Version of repr() which can handle recursive data structures.

Usage

import pprint

a: list = []
a.append(a)
assert "Recursion" in pprint.saferepr(a)

Gotchas

REPL Inspect

from pprint import saferepr
help(saferepr)

Linked from

Related notes