Skip to content

Commit 4faf413

Browse files
committed
pprint: add test_pprint.py
1 parent 968a063 commit 4faf413

2 files changed

Lines changed: 488 additions & 3 deletions

File tree

python-stdlib/pprint/pprint.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@ def pp(obj, *args, sort_dicts=False, **kwargs):
5353
def pprint(obj, stream=None, indent=1, depth=1, sort_dicts=True):
5454
"""Simple implementation of a pretty-printer.
5555
56-
For simplicity, this does not recurse down. It does not produce the same
57-
output as the CPython implementation. Instead, it is intended to simply
58-
expand lists and dictionaries to multiple lines for easy viewing.
56+
It does not produce the same output as the CPython implementation, but it's
57+
close. Instead, it is intended to simply expand lists and dictionaries to
58+
multiple lines for easy viewing. When the recursion depth has been
59+
reached, the elements will be printed with repl(item) instead of the
60+
CPython implementation of eliding the results (e.g., "{...}"). This is
61+
because this implementation is not as safe as the CPython implementation
62+
for deep recursion, which is detailed two paragraphs lower.
5963
6064
Only expands containers. Currently supported containers are set, list,
6165
dict, and tuple.

0 commit comments

Comments
 (0)