Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix changes order in documentation
  • Loading branch information
Rémi Lapeyre
Rémi Lapeyre committed Feb 6, 2019
commit 52f6ed3c87ac23dbac717fd41837dfff3a3f1626
12 changes: 6 additions & 6 deletions Doc/library/pprint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ The :mod:`pprint` module also provides several shortcut functions:
*width*, *depth*, *compact* and *sort_dicts* will be passed to the
:class:`PrettyPrinter` constructor as formatting parameters.

.. versionchanged:: 3.8
Added the *sort_dicts* parameter.

.. versionchanged:: 3.4
Added the *compact* parameter.

.. versionchanged:: 3.8
Added the *sort_dicts* parameter.


.. function:: pp(object, *args, sort_dicts=False, **kwargs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth explicitely saying that this is an alias of pprint() with sort_dict=False ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a mention of *args and **kwargs being passed to pprint and sort_dicts=False is in the signature of pp so I don't think it is necessary.

I would like to also like to avoid giving to much details about pp implementation because we may change some things if another data structure of Python changes like dicts did.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(if we were to do change what this function does, we would also change the doc, but I'm good with that.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth explicitely saying that this is an alias of pprint() with sort_dict=False ?

At first glance I was puzzled why both pp() and pprint() existed, and it took a moment to spot the different default sort_dict value - and I ended up having to confirm via source code inspection that there were no other differences between the two.

As such, the above mentioned docs would have been useful for me personally :-)


Expand All @@ -122,12 +122,12 @@ The :mod:`pprint` module also provides several shortcut functions:
within a scope). *indent*, *width*, *depth*, *compact* and *sort_dicts* will
be passed to the :class:`PrettyPrinter` constructor as formatting parameters.

.. versionchanged:: 3.8
Added the *sort_dicts* parameter.

.. versionchanged:: 3.4
Added the *compact* parameter.

.. versionchanged:: 3.8
Added the *sort_dicts* parameter.

>>> import pprint
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
>>> stuff.insert(0, stuff)
Expand Down