On this page
reprlib.Repr
Prev: reprlib.repr | Up: reprlib
Rel: reprlib.recursive_repr, reprlib.repr
Ref: docs.python.org — reprlib.Repr
Tags: #public #python3 #stdlib #reprlib
Import
import reprlib
from reprlib import Repr
Signature & Overview
reprlib.Repr(*, maxlevel=6, maxtuple=6, maxlist=6, maxarray=5, maxdict=4, maxset=6, maxfrozenset=6, maxdeque=6, maxstring=30, maxlong=40, maxother=30, fillvalue='...', indent=None)
reprlib.Repr class.
Methods & Attributes
Repr.repr(self, x)—Repr.reprmethod/property.Repr.repr1(self, x, level)—Repr.repr1method/property.Repr.repr_array(self, x, level)—Repr.repr_arraymethod/property.Repr.repr_deque(self, x, level)—Repr.repr_dequemethod/property.Repr.repr_dict(self, x, level)—Repr.repr_dictmethod/property.Repr.repr_frozenset(self, x, level)—Repr.repr_frozensetmethod/property.Repr.repr_instance(self, x, level)—Repr.repr_instancemethod/property.Repr.repr_int(self, x, level)—Repr.repr_intmethod/property.Repr.repr_list(self, x, level)—Repr.repr_listmethod/property.Repr.repr_set(self, x, level)—Repr.repr_setmethod/property.Repr.repr_str(self, x, level)—Repr.repr_strmethod/property.Repr.repr_tuple(self, x, level)—Repr.repr_tuplemethod/property.
Usage
import reprlib
r = reprlib.Repr(maxlist=2, maxstring=10)
assert r.repr([1, 2, 3, 4]) == '[1, 2, ...]'
Gotchas
- Create your own
Repr(...)instance instead of mutating module-globalreprlib.aRepr.
REPL Inspect
from reprlib import Repr
help(Repr)
Linked from
Related notes
- tuts/python3/stdlib_module/reprlib/recursive_repr Linked here; links to this page; shared tags: #reprlib, #stdlib
- tuts/python3/stdlib_module/reprlib/repr Linked here; links to this page; shared tags: #reprlib, #stdlib
- tuts/python3/stdlib_module/reprlib Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib