Support to pretty-print lists, tuples, & dictionaries recursively.
Very simple, but useful, especially in debugging data structures. Slight extension of the original pprint module in Python such that floating-point numbers can be written with a specificed format (float_format) and not by their repr string (which explicitly displays round-off errors).
Classes:
- PrettyPrinter(): Handle pretty-printing operations onto a stream using a configured set of formatting parameters.
Functions:
- pformat(): Format a Python object into a pretty-printed representation.
- pprint(): Pretty-print a Python object to a stream [default is sys.stdout].
- saferepr(): Generate a ‘standard’ repr()-like value, but protect against recursive data structures.
Global data:
- float_format: String containing the printf format for formatting float objects.
Pretty-print a Python object to a stream [default is sys.stdout].
Format a Python object into a pretty-printed representation.
Determine if object requires a recursive representation.
Version of repr() which can handle recursive data structures.
Methods
format(object, context, maxlevels, level) | Format object for a specific context, returning a string |
isreadable(object) | |
isrecursive(object) | |
pformat(object) | |
pprint(object) |