GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — bpo-30670: Add pp function to the pprint module by remilapeyre · Pull Request #11769 · python/cpython Conversation
|
| Added the *sort_dicts* parameter. | ||
|
|
||
|
|
||
| .. function:: pp(object, *args, sort_dicts=False, **kwargs) |
There was a problem 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 ?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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.)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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 :-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks @vadmium! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* Add "pp" to __all__ * Drop mention of alphabetical sorting. It is just plain sorting (i.e. dict with integer keys get sorted as well). * Fix spelling of "parameter"
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.