pprintpp
pprintpp copied to clipboard
add sort_dicts option
As regular dicts have guaranteed order from Python 3.7, it makes sense to add sort_dicts option as in case of pprint from the standard library.
Hey! Thanks for the PR!
Two things:
- The default should be
Falseon Py3 (as dicts are already ordered) and the documentation should reflect this - Please add tests, including one which confirms that it will only sort
dicts, not dict-like things likeOrderedDictwhich already have an order.
Hi. Thanks a million for your quick reply. Unfortunately I'm currently overloaded and may not be able to deliver this change. Let's forget about it. Sorry for bothering.
Re 1. above, I actually think it should default to True (as is now) because that's the default value in Python 3.8 and if this package is to be a drop replacement o pprint, then keeping the default values should be observed.
Came here looking for this functionality and found this issue. Is this still something that you would be interested in merging (if relevant tests were added?)
Appears t work fine, would love to this this actually be in. Too bad there hasn't been any activity on this.
IMO ideally sort_dicts would differ based on contextual use-case:
- as ipython/repl default repr printer extension: should be
Falselike default repl - called as a function after import: should be
Truelikepprint