Nick Timkovich <prometheus...@gmail.com> added the comment:
It's not clear what you suggest, but it is likely better to alert the user that their keys have mismatched types than to suppress it by default. Perhaps alongside the `sort_keys` argument, you would like a parameter that gets passed into `sorted()` when the items are sorted? Perhaps an additional argument, or if sort_keys is a callable, use that as the `key` argument to sorted? ``` strange = {"1":"one", 2:"ii"} json.dumps(strange, sort_keys=True, key=str) json.dumps(strange, sort_keys=str) # {"1": "one", 2: "ii"} ``` ---------- nosy: +nicktimko _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38046> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com