[issue29863] Add a COMPACT constant to the json module

2017-05-13 Thread Brett Cannon

Brett Cannon added the comment:

Obviously Bob can re-open this if he disagrees with the general sentiment 
against this idea, but since I doubt he will disagree I'm going to save him 
some effort and close this issue.

Thanks to Andrew for taking the time to writing the PR and being patient while 
we discussed this.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-05-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Note also that using separators=COMPACT doesn't guarantee the most compact 
output. As Inada mentioned ensure_ascii=False may make JSON more compact. And 
you shouldn't use non-default indent!

I don't understand effort spent for this issue. Even if add json.COMPACT you 
could use it only with 3.7+. And adding a named constant in your program is 
just one line!

--

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-05-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Having mulled this over for a while, I'm disinclined to go forward with this 
proposal.  On the one hand, it is a relatively small change, so it doesn't 
affect the overall complexity much.  However, API design principles suggest 
that this isn't the right thing to do.

Good APIs tend to steer users towards correct design.  I'm concerned that 
adding a COMPACT constant will suggest to users that compacting separators in 
the output is something they should be doing.  Instead, it is a distracting 
micro-optimization that rarely saves much space but comes at a cost of 
readability (it is no fun to have to read JSON without spaces).

For other kinds of code generation, minification is normally a post-processing 
step rather than something incorporated into the generator itself.  When we 
care about the size of JSON, we really want people to use compression rather 
than feebly editing-out a few spaces.

The main reason to have the *separators* argument is to factor-out hardwired 
behavior.  It wasn't really about binary choices: normal-vs-thin, 
readable-vs-smushed.

Lastly, I don't really like having two-ways-to-do-it.  We already have 
something that works, so should have we should have a preference for 
documenting what we have rather than leaning towards continuous slow sprawl 
with new options that aren't backwards compatible (creating yet another 
cross-version maintenance issue).

--

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-05-12 Thread Andrew Nester

Andrew Nester added the comment:

any conclusion on this? looks like it's a bit stuck

--
nosy: +andrewnester

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-04-02 Thread Berker Peksag

Berker Peksag added the comment:

+1. See msg287773 for my reasoning.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-21 Thread Bob Ippolito

Bob Ippolito added the comment:

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.

--

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

-0 too. This complicates the module API without a need.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-21 Thread INADA Naoki

INADA Naoki added the comment:

-0.  COMPACT_SEPARATOR make more sense to me.
Because `ensure_ascii=False` may make JSON more compact too.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Actually, only put me down for -0.  This isn't a necessary change but it isn't 
egregious either.

--

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

-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.

--
assignee:  -> bob.ippolito
nosy: +bob.ippolito

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Eric V. Smith

Eric V. Smith added the comment:

+1: gets the job done without complicating the API.

--
nosy: +eric.smith

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Andrew Nester

Changes by Andrew Nester :


--
pull_requests: +657

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +benhoyt, r.david.murray

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Brett Cannon

New submission from Brett Cannon:

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.

--
components: Library (Lib)
messages: 289905
nosy: brett.cannon, ezio.melotti, rhettinger
priority: normal
severity: normal
status: open
title: Add a COMPACT constant to the json module
type: enhancement
versions: Python 3.7

___
Python tracker 

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