pretty_print
Functions and classes for pretty printing.
New in version 0.10.0.
Classes:
|
Subclass of |
Functions:
|
Adds a simple |
-
class
FancyPrinter
(indent=1, width=80, depth=None, stream=None, *, compact=False, sort_dicts=True)[source] Bases:
PrettyPrinter
Subclass of
PrettyPrinter
with different formatting.- Parameters
indent (
int
) – Number of spaces to indent for each level of nesting. Default1
.width (
int
) – Attempted maximum number of columns in the output. Default80
.depth (
Optional
[int
]) – The maximum depth to print out nested structures. DefaultNone
.stream (
Optional
[IO
[str
]]) – The desired output stream. If omitted (orFalse
), the standard output stream available at construction will be used. DefaultNone
.compact (
bool
) – IfTrue
, several items will be combined in one line. DefaultFalse
.sort_dicts (
bool
) – IfTrue
, dict keys are sorted. Only takes effect on Python 3.8 and later, or if pprint36 is installed. DefaultTrue
.
-
simple_repr
(*attributes, show_module=False, **kwargs)[source] Adds a simple
__repr__
method to the decorated class.- Parameters
attributes – The attributes to include in the
__repr__
.show_module (
bool
) – Whether to show the name of the module in the__repr__
. DefaultFalse
.**kwargs – Keyword arguments passed on to
pprint.PrettyPrinter
.