@@ -42,24 +42,36 @@ The :mod:`pprint` module defines one class:
4242 compact=False, sort_dicts=True, underscore_numbers=False)
4343
4444 Construct a :class: `PrettyPrinter ` instance. This constructor understands
45- several keyword parameters. An output stream may be set using the *stream *
46- keyword; the only method used on the stream object is the file protocol's
47- :meth: `write ` method. If not specified, the :class: `PrettyPrinter ` adopts
48- ``sys.stdout ``. The
49- amount of indentation added for each recursive level is specified by *indent *;
50- the default is one. Other values can cause output to look a little odd, but can
51- make nesting easier to spot. The number of levels which may be printed is
52- controlled by *depth *; if the data structure being printed is too deep, the next
53- contained level is replaced by ``... ``. By default, there is no constraint on
54- the depth of the objects being formatted. The desired output width is
55- constrained using the *width * parameter; the default is 80 characters. If a
56- structure cannot be formatted within the constrained width, a best effort will
57- be made. If *compact * is false (the default) each item of a long sequence
58- will be formatted on a separate line. If *compact * is true, as many items
59- as will fit within the *width * will be formatted on each output line. If
60- *sort_dicts * is true (the default), dictionaries will be formatted with their
61- keys sorted, otherwise they will display in insertion order. If
62- *underscore_numbers * is true, integers will be formatted with the
45+ several keyword parameters.
46+
47+ *stream * (default ``sys.stdout ``) is a :term: `file-like object ` to
48+ which the output will be written by calling its :meth: `write ` method.
49+
50+ Other values configure the manner in which nesting of complex data
51+ structures is displayed.
52+
53+ *indent * (default 1) specifies the amount of indentation added for
54+ each nesting level.
55+
56+ *depth * controls the number of nesting levels which may be printed; if
57+ the data structure being printed is too deep, the next contained level
58+ is replaced by ``... ``. By default, there is no constraint on the
59+ depth of the objects being formatted.
60+
61+ *width * (default 80) specifies the desired maximum number of characters per
62+ line in the output. If a structure cannot be formatted within the width
63+ constraint, a best effort will be made.
64+
65+ *compact * impacts the way that long sequences (lists, tuples, sets, etc)
66+ are formatted. If *compact * is false (the default) then each item of a
67+ sequence will be formatted on a separate line. If *compact * is true, as
68+ many items as will fit within the *width * will be formatted on each output
69+ line.
70+
71+ If *sort_dicts * is true (the default), dictionaries will be formatted with
72+ their keys sorted, otherwise they will display in insertion order.
73+
74+ If *underscore_numbers * is true, integers will be formatted with the
6375 ``_ `` character for a thousands separator, otherwise underscores are not
6476 displayed (the default).
6577
0 commit comments