[issue24518] json.dumps should accept key function for ``sort_keys``

2020-02-29 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

I've rebased Catherine Devlin's patch onto 3.9 (and adjusted the docs a tiny 
bit). If anyone still is interested, I can create a PR (for 3.9) for this.

--
nosy: +erlendaasland
Added file: 
https://bugs.python.org/file48936/0001-bpo-24518-json.dumps-should-accept-key-function-for-.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24518] json.dumps should accept key function for ``sort_keys``

2018-03-12 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

As there was interest in this patch, @catherinedevlin would you be able to make 
a Github pull request for it?

Thanks!

--
nosy: +csabella
stage:  -> needs patch
versions: +Python 3.8 -Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24518] json.dumps should accept key function for ``sort_keys``

2015-07-03 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Catherine, if you are going to continue contributing patches, which we hope you 
do, please sign the PSF Contribution Agreement.
https://www.python.org/psf/contrib/
https://www.python.org/psf/contrib/contrib_form/

It would be needed if this patch were to be used, but I presume Bob would 
import the patch from simplejson instead.

--
nosy: +terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24518
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24518] json.dumps should accept key function for ``sort_keys``

2015-06-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The idea and patch look reasonable.

Bob, what do you think?

--
assignee:  - bob.ippolito
nosy: +bob.ippolito, rhettinger
versions: +Python 3.6 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24518
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24518] json.dumps should accept key function for ``sort_keys``

2015-06-29 Thread Bob Ippolito

Bob Ippolito added the comment:

Seems like a good idea to me, I'll make sure this gets in simplejson as well.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24518
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24518] json.dumps should accept key function for ``sort_keys``

2015-06-29 Thread Bob Ippolito

Bob Ippolito added the comment:

On further investigation, simplejson has implemented this functionality under a 
different name since 2.5.0 (2012-03-29).


If item_sort_key is a callable (not the default), then the output of 
dictionaries will be sorted with it. The callable will be used like this: 
sorted(dct.items(), key=item_sort_key). This option takes precedence over 
sort_keys.

Changed in version 2.5.0: item_sort_key is new in 2.5.0.


--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24518
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24518] json.dumps should accept key function for ``sort_keys``

2015-06-27 Thread Catherine Devlin

Catherine Devlin added the comment:

Implementation for the enhancement.  Includes tests.

--
keywords: +patch
Added file: http://bugs.python.org/file39823/json_callable_sort_24518.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24518
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24518] json.dumps should accept key function for ``sort_keys``

2015-06-26 Thread Catherine Devlin

New submission from Catherine Devlin:

Right now, json.dumps can be called with True or False, but it would be easy to 
also support accepting a key function, which then could be used to control the 
order of keys arbitrarily in the serialized JSON output.

--
components: Library (Lib)
messages: 245874
nosy: catherinedevlin
priority: normal
severity: normal
status: open
title: json.dumps should accept key function for ``sort_keys``
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24518
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com