Title: Add a COMPACT constant to the json module
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: bob.ippolito Nosy List: benhoyt, berker.peksag, bob.ippolito, brett.cannon, eric.smith, ezio.melotti, inada.naoki, r.david.murray, rhettinger, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-03-20 22:33 by brett.cannon, last changed 2017-04-03 05:31 by berker.peksag.

Pull Requests
URL Status Linked Edit
PR 72 open andrewnester, 2017-03-20 22:34
Messages (8)
msg289905 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2017-03-20 22:33
In issue #29540 there was a suggestion to add a `compact` argument to json.dump() and json.dumps(). That was eventually rejected as adding complexity to an API that's already messy.

But in GH-72 someone created a COMPACT constant to the json module which gets a similar effect as a `compact` argument but without expanding any APIs. Unfortunately I think the constant proposal got lost in discussion of adding the `compact` argument, so I'm opening a new issue to make a final decision as to whether we should accept/reject the COMPACT constant idea.
msg289906 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2017-03-20 23:14
+1: gets the job done without complicating the API.
msg289910 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-03-21 04:06
-1 We already have a way to do it.  I teach this way in my Python courses and there is a zero learning curve. It isn't difficult at all.
msg289912 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-03-21 04:51
Actually, only put me down for -0.  This isn't a necessary change but it isn't egregious either.
msg289921 - (view) Author: INADA Naoki (inada.naoki) * (Python committer) Date: 2017-03-21 07:10
-0.  COMPACT_SEPARATOR make more sense to me.
Because `ensure_ascii=False` may make JSON more compact too.
msg289923 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-21 07:28
-0 too. This complicates the module API without a need.
msg289942 - (view) Author: Bob Ippolito (bob.ippolito) * (Python committer) Date: 2017-03-21 15:59
I suppose I'm +0. I don't think this is particularly useful, but this is closer to the ideal of just having a boolean option. We should probably also plan to remove the documentation for what the type of separators is to give the impression that COMPACT and the default are the only valid options.
msg291053 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-04-03 05:31
+1. See msg287773 for my reasoning.
Date User Action Args
2017-04-03 05:31:56berker.peksagsetnosy: + berker.peksag
messages: + msg291053
2017-03-21 15:59:47bob.ippolitosetmessages: + msg289942
2017-03-21 07:28:44serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg289923
2017-03-21 07:10:30inada.naokisetnosy: + inada.naoki
messages: + msg289921
2017-03-21 04:51:13rhettingersetmessages: + msg289912
2017-03-21 04:06:20rhettingersetassignee: bob.ippolito

messages: + msg289910
nosy: + bob.ippolito
2017-03-20 23:14:51eric.smithsetnosy: + eric.smith
messages: + msg289906
2017-03-20 22:34:11andrewnestersetpull_requests: + pull_request657
2017-03-20 22:33:53brett.cannonsetnosy: + r.david.murray, benhoyt
2017-03-20 22:33:19brett.cannoncreate