PrettyPrinter instances have the following methods:
object) |
object) |
The following methods provide the implementations for the corresponding functions of the same names. Using these methods on an instance is slightly more efficient since new PrettyPrinter objects don't need to be created.
object) |
False
for
recursive objects. If the depth parameter of the
PrettyPrinter is set and the object is deeper than allowed,
this returns False
.
object) |
This method is provided as a hook to allow subclasses to modify the way objects are converted to strings. The default implementation uses the internals of the saferepr() implementation.
object, context, maxlevels, level) |
True
. Recursive calls to the format()
method should add additional entries for containers to this
dictionary. The third argument, maxlevels, gives the requested
limit to recursion; this will be 0
if there is no requested
limit. This argument should be passed unmodified to recursive calls.
The fourth argument, level, gives the current level; recursive
calls should be passed a value less than that of the current call.
New in version 2.3.