reprlib
Redo the builtin repr() (representation) but with limits on most sizes.
The reprlib module provides a means for producing object representations with limits on the size of the resulting strings. This is used in the Python debugger and may be useful in other contexts as well.
This module provides a struct, an instance, and a function:
reprlib.Repr
- struct which provides formatting services useful in implementing functions similar to the built-in repr(); size limits for different object types are added to avoid the generation of representations which are excessively long.
reprlib.aRepr
- this is an instance of Repr which is used to provide the repr() function described below. Changing the attributes of this object will affect the size limits used by repr() and Python (or in the future, a Larky) debugger.
reprlib.repr(obj)
- This is the repr() method of aRepr. It returns a string similar to that returned by the built-in function of the same name, but with limits on most sizes.
This diverges from CPython’s reprlib
in that it does not provide a decorator for detecting recursive calls to repr() since Larky does not support recursion.
More here: module-replib ported to Larky from: replib
reprlib.Repr()
Repr struct:
Repr instances provide several attributes which can be used to provide size limits for the representations of different object types, and methods which format specific object types.
Last updated