8000 gh-115986 Improve pprint docs formatting by Privat33r-dev · Pull Request #117401 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
8000

gh-115986 Improve pprint docs formatting #117401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 27, 2024
Prev Previous commit
Next Next commit
Remove duplication of the parameters' description
  • Loading branch information
Privat33r-dev authored Jun 26, 2024
commit aeb9488674dba0281fabfed5718958620aad1ab6
39 changes: 2 additions & 37 deletions Doc/library/pprint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,43 +160,8 @@ PrettyPrinter Objects

Construct a :class:`PrettyPrinter` instance.

:param int indent:
The amount of indentation added for each nesting level.

:param int width:
The desired maximum number of characters per line in the output.
If a structure cannot be formatted within the width constraint,
a best effort will be made.

:param depth:
The number of nesting levels which may be printed.
If the data structure being printed is too deep,
the next contained level is replaced by ``...``.
If ``None`` (the default), there is no constraint
on the depth of the objects being formatted.
:type depth: int | None

:param stream:
A file-like object to which the output will be written
by calling its :meth:`!write` method.
If ``None`` (the default), :data:`sys.stdout` is used.
:type stream: :term:`file-like object` | None

:param bool compact:
Control the way long :term:`sequences <sequence>` are formatted.
If ``False`` (the default),
each item of a sequence will be formatted on a separate line,
otherwise as many items as will fit within the *width*
will be formatted on each output line.

:param bool sort_dicts:
If ``True`` (the default), dictionaries will be formatted with
their keys sorted, otherwise they will be displayed in insertion order.

:param bool underscore_numbers:
If ``True``,
integers will be formatted with the ``_`` character for a thousands separator,
otherwise underscores are not displayed (the default).
Arguments have the same meaning as for :func:`~pprint.pp`.
Note that they are in a different order, and that *sort_dicts* defaults to ``True``.

>>> import pprint
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
Expand Down
Loading
0