##
3.27.1 PrettyPrinter Objects

`PrettyPrinter` instances have the following methods:

`pformat`( | object)

  Return the formatted representation of object. This takes into Account the options passed to the `PrettyPrinter` constructor.

`pprint`( | object)

  Print the formatted representation of object on the configured stream, followed by a newline.

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.

`isreadable`( | object)

  Determine if the formatted representation of the object is ``readable,'' or can be used to reconstruct the value using `eval()`. Note that this returns false for recursive objects. If the depth parameter of the `PrettyPrinter` is set and the object is deeper than allowed, this returns false.

`isrecursive`( | object)

  Determine if the object requires a recursive representation.

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.

`format`( | object, context, maxlevels, level)

  Returns three values: the formatted version of object as a string, a flag indicating whether the result is readable, and a flag indicating whether recursion was detected. The first argument is the object to be presented. The second is a dictionary which contains the `id()` of objects that are part of the current presentation context (direct and indirect containers for object that are affecting the presentation) as the keys; if an object needs to be presented which is already represented in context, the third return value should be true. Recursive calls to the `format()` method should add additional entries for containers to this dictionary. The fourth 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.