@@ -44,6 +44,17 @@ Functions
4444 *args * and *kwargs * will be passed to :func: `~pprint.pprint ` as formatting
4545 parameters.
4646
47+ >>> import pprint
48+ >>> stuff = [' spam' , ' eggs' , ' lumberjack' , ' knights' , ' ni' ]
49+ >>> stuff.insert(0 , stuff)
50+ >>> pprint.pp(stuff)
51+ [<Recursion on list with id=...>,
52+ 'spam',
53+ 'eggs',
54+ 'lumberjack',
55+ 'knights',
56+ 'ni']
57+
4758 .. versionadded :: 3.8
4859
4960
@@ -61,16 +72,8 @@ Functions
6172 :class: `PrettyPrinter ` constructor and their meanings are as
6273 described in its documentation below.
6374
64- >>> import pprint
65- >>> stuff = [' spam' , ' eggs' , ' lumberjack' , ' knights' , ' ni' ]
66- >>> stuff.insert(0 , stuff)
67- >>> pprint.pprint(stuff)
68- [<Recursion on list with id=...>,
69- 'spam',
70- 'eggs',
71- 'lumberjack',
72- 'knights',
73- 'ni']
75+ Note that *sort_dicts * is ``True `` by default and you might want to use
76+ :func: `~pprint.pp ` instead where it is ``False `` by default.
7477
7578.. function :: pformat(object, indent=1, width=80, depth=None, *, \
7679 compact=False, sort_dicts=True, underscore_numbers=False)
@@ -261,7 +264,7 @@ are converted to strings. The default implementation uses the internals of the
261264Example
262265-------
263266
264- To demonstrate several uses of the :func: `~pprint.pprint ` function and its parameters,
267+ To demonstrate several uses of the :func: `~pprint.pp ` function and its parameters,
265268let's fetch information about a project from `PyPI <https://pypi.org >`_::
266269
267270 >>> import json
@@ -270,9 +273,9 @@ let's fetch information about a project from `PyPI <https://pypi.org>`_::
270273 >>> with urlopen('https://pypi.org/pypi/sampleproject/json') as resp:
271274 ... project_info = json.load(resp)['info']
272275
273- In its basic form, :func: `~pprint.pprint ` shows the whole object::
276+ In its basic form, :func: `~pprint.pp ` shows the whole object::
274277
275- >>> pprint.pprint (project_info)
278+ >>> pprint.pp (project_info)
276279 {'author': 'The Python Packaging Authority',
277280 'author_email': '[email protected] ', 278281 'bugtrack_url': None,
@@ -329,7 +332,7 @@ In its basic form, :func:`~pprint.pprint` shows the whole object::
329332The result can be limited to a certain *depth * (ellipsis is used for deeper
330333contents)::
331334
332- >>> pprint.pprint (project_info, depth=1)
335+ >>> pprint.pp (project_info, depth=1)
333336 {'author': 'The Python Packaging Authority',
334337 'author_email': '[email protected] ', 335338 'bugtrack_url': None,
@@ -375,7 +378,7 @@ contents)::
375378Additionally, maximum character *width * can be suggested. If a long object
376379cannot be split, the specified width will be exceeded::
377380
378- >>> pprint.pprint (project_info, depth=1, width=60)
381+ >>> pprint.pp (project_info, depth=1, width=60)
379382 {'author': 'The Python Packaging Authority',
380383 'author_email': '[email protected] ', 381384 'bugtrack_url': None,
0 commit comments