Feature or enhancement
Proposal:
reprlib.Repr currently sorts dictionaries by key when producing representations. However, sometimes the insertion order is meaningful. It would be useful to have a sort_dicts parameter, analogous to the existing parameter in pprint.PrettyPrinter & friends.
The proposed API is:
orepr = reprlib.Repr(sort_dicts=False)
orepr.repr(my_ordered_dict)
The default should be True to preserve the existing behavior.
A possible implementation is here:
main...warden127:cpython:reprlib-sort_dicts
Has this already been discussed elsewhere?
I have already opened a thread under Ideas on discuss.python.org a couple days ago, but got no response (and therefore no objections *wink*).
Links to previous discussion of this feature:
Linked PRs
Feature or enhancement
Proposal:
reprlib.Reprcurrently sorts dictionaries by key when producing representations. However, sometimes the insertion order is meaningful. It would be useful to have asort_dictsparameter, analogous to the existing parameter inpprint.PrettyPrinter& friends.The proposed API is:
The default should be
Trueto preserve the existing behavior.A possible implementation is here:
main...warden127:cpython:reprlib-sort_dicts
Has this already been discussed elsewhere?
I have already opened a thread under Ideas on discuss.python.org a couple days ago, but got no response (and therefore no objections *wink*).
Links to previous discussion of this feature:
Linked PRs