Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions Doc/library/pprint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Functions
---------

.. function:: pp(object, stream=None, indent=1, width=80, depth=None, *, \
compact=False, expand=False, sort_dicts=False, \
color=True, compact=False, expand=False, sort_dicts=False, \
underscore_numbers=False)

Prints the formatted representation of *object*, followed by a newline.
Expand Down Expand Up @@ -64,6 +64,12 @@ Functions
on the depth of the objects being formatted.
:type depth: int | None

:param bool color:
If ``True`` (the default), output will be syntax highlighted using ANSI
escape sequences, if the *stream* and :ref:`environment variables
<using-on-controlling-color>` permit.
If ``False``, colored output is always disabled.

:param bool compact:
Control the way long :term:`sequences <sequence>` are formatted.
If ``False`` (the default),
Expand Down Expand Up @@ -101,15 +107,21 @@ Functions

.. versionadded:: 3.8

.. versionchanged:: next
Added the *color* parameter.


.. function:: pprint(object, stream=None, indent=1, width=80, depth=None, *, \
compact=False, expand=False, sort_dicts=True, \
color=True, compact=False, expand=False, sort_dicts=True, \
underscore_numbers=False)

Alias for :func:`~pprint.pp` with *sort_dicts* set to ``True`` by default,
which would automatically sort the dictionaries' keys,
you might want to use :func:`~pprint.pp` instead where it is ``False`` by default.

.. versionchanged:: next
Added the *color* parameter.


.. function:: pformat(object, indent=1, width=80, depth=None, *, \
compact=False, expand=False, sort_dicts=True, \
Expand Down Expand Up @@ -154,14 +166,14 @@ Functions

.. _prettyprinter-objects:

PrettyPrinter Objects
PrettyPrinter objects
---------------------

.. index:: single: ...; placeholder

.. class:: PrettyPrinter(indent=1, width=80, depth=None, stream=None, *, \
compact=False, expand=False, sort_dicts=True, \
underscore_numbers=False)
color=True, compact=False, expand=False, \
sort_dicts=True, underscore_numbers=False)

Construct a :class:`PrettyPrinter` instance.

Expand Down Expand Up @@ -220,6 +232,9 @@ PrettyPrinter Objects
.. versionchanged:: 3.11
No longer attempts to write to :data:`!sys.stdout` if it is ``None``.

.. versionchanged:: next
Added the *color* parameter.

.. versionchanged:: 3.15
Added the *expand* parameter.

Expand Down
Loading
Loading