Skip to content

Conversation

@gergelyk
Copy link

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.

@wolever
Copy link
Owner

wolever commented Apr 23, 2020

Hey! Thanks for the PR!

Two things:

  1. The default should be False on Py3 (as dicts are already ordered) and the documentation should reflect this
  2. Please add tests, including one which confirms that it will only sort dicts, not dict-like things like OrderedDict which already have an order.

@gergelyk
Copy link
Author

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.

@joaonc joaonc mentioned this pull request May 5, 2020
@joaonc
Copy link

joaonc commented May 5, 2020

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.

@peter-malcolm-bw
Copy link

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?)

@Sil3ntStorm
Copy link

Appears t work fine, would love to this this actually be in. Too bad there hasn't been any activity on this.

@Kache
Copy link

Kache commented Jul 15, 2022

IMO ideally sort_dicts would differ based on contextual use-case:

  • as ipython/repl default repr printer extension: should be False like default repl
  • called as a function after import: should be True like pprint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants