[issue16333] Trailing whitespace in json dump when using indent

2014-03-10 Thread Roundup Robot
Roundup Robot added the comment: New changeset bb43e8e05a7c by R David Murray in branch 'default': whatsnew: json dump-with-indent whitespace change (#16333). http://hg.python.org/cpython/rev/bb43e8e05a7c -- ___ Python tracker

[issue16333] Trailing whitespace in json dump when using indent

2012-12-14 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Éric Araujo
Éric Araujo added the comment: All right. :) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyt

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Ezio Melotti
Ezio Melotti added the comment: > I noticed in the check-in mail that you added the note before > the description of the separators argument The note is just after the description of the indent argument, because it's relevant only when a indent value is specified. > Regular text would have loo

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Éric Araujo
Éric Araujo added the comment: Ezio, I noticed in the check-in mail that you added the note before the description of the separators argument (specifically, the descrition of what it does when it’s a tuple). Maybe it would flow best to move the note after that part? Also, I don’t think this

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset 1e3b01c52aee by Ezio Melotti in branch 'default': #16333: add Misc/NEWS entry for e63ac05ccfa8. http://hg.python.org/cpython/rev/1e3b01c52aee -- ___ Python tracker ___

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Ezio Melotti
Ezio Melotti added the comment: I committed the patches leaving out the json.tool changes. I will commit those as part of #16476. Thanks Serhiy for the patches! -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset e7919cf9b5e5 by Ezio Melotti in branch 'default': #16333: fix example in docstring. http://hg.python.org/cpython/rev/e7919cf9b5e5 -- ___ Python tracker ___

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset 78bad589f205 by Ezio Melotti in branch '2.7': #16333: document a way to get rid of trailing whitespace when indent is used. http://hg.python.org/cpython/rev/78bad589f205 New changeset 2a5b183ac3cd by Ezio Melotti in branch '3.2': #16333: document a

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Éric Araujo
Changes by Éric Araujo : -- components: +Documentation versions: +Python 2.7, Python 3.2, Python 3.3 ___ Python tracker ___ ___ Python

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Please left 2.7, 3.2 and 3.3 for documentation changes (the second patch). -- ___ Python tracker ___ _

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Éric Araujo
Éric Araujo added the comment: I agree with RDM. -- versions: -Python 2.7, Python 3.2, Python 3.3 ___ Python tracker ___ ___ Python-b

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread R. David Murray
R. David Murray added the comment: Yes, I think the risk of breaking doctests (and breaking them in a very mysterious way...trailing spaces) is high enough that we shouldn't backport the fix, unfortunately. -- ___ Python tracker

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Ezio Melotti
Ezio Melotti added the comment: > There is no promise of binary compatibility for pretty-printed data. This was the reason that made me consider backporting this on the other branches. After all I expect this feature to be used from the terminal, while printing JSON in a human-friendly format

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch which adds a suggestion to use appropriate separators with indent. It also use they in Lib/json/tool.py. I suggest this patch only for old Python, up to 3.3. For 3.4 this is not needed if my previous suggestion will be accepted. -- A

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread anatoly techtonik
anatoly techtonik added the comment: The problem with policy and 'common sense' is that not everybody can feel that 'common sense', especially when there is no time to go deep into the issue. Policy is a quick and good 42 no matter that the matter is. The problem that it is also a filter, whic

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread R. David Murray
R. David Murray added the comment: "Code smell" and "Easily fixable on their side" are not an arguments that apply here. We have a strong backward compatibility policy that strives not to break working code in bug fix releases. And yes, this means that there are sometimes bugs that we only f

[issue16333] Trailing whitespace in json dump when using indent

2012-11-28 Thread anatoly techtonik
anatoly techtonik added the comment: > The reason is that people might rely on exact output and it's not nice to > break their code in a bugfix release. This code has a very bad smell. Between supporting people who did that and teaching them a lesson I choose the latter, but I bet the situatio

[issue16333] Trailing whitespace in json dump when using indent

2012-11-27 Thread Ezio Melotti
Ezio Melotti added the comment: > Do you mean that when indentation is used, the separator only appears on line > ends? Apparently: ./python -c 'from json import dumps; print(dumps([[[1,2,3]]*3]*3, indent=2))' -- ___ Python tracker

[issue16333] Trailing whitespace in json dump when using indent

2012-11-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: For older Python we need add in in the documentation the suggestion to use "separators=(',', ': ')" when indentation used. -- ___ Python tracker

[issue16333] Trailing whitespace in json dump when using indent

2012-11-26 Thread Ezio Melotti
Changes by Ezio Melotti : -- assignee: -> ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://

[issue16333] Trailing whitespace in json dump when using indent

2012-11-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: I agree with Serhiy, this should be going in 3.4 only. The reason is that people might rely on exact output and it's not nice to break their code in a bugfix release. -- ___ Python tracker

[issue16333] Trailing whitespace in json dump when using indent

2012-11-26 Thread anatoly techtonik
anatoly techtonik added the comment: > ',' used by default only when indentation used. It increases readability. Do you mean that when indentation is used, the separator only appears on line ends? Otherwise I can see how,is,that,more readable, than, that. > Of course, this is a new feature and

[issue16333] Trailing whitespace in json dump when using indent

2012-11-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Of course, this is a new feature and should be only in 3.4. -- nosy: +pitrou, rhettinger type: behavior -> enhancement versions: -Python 2.7, Python 3.2, Python 3.3 ___ Python tracker

[issue16333] Trailing whitespace in json dump when using indent

2012-11-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > ',' makes lists less readable, directly the opposite of what the *indent* > option is for. ',' used by default only when indentation used. It increases readability. -- ___ Python tracker

[issue16333] Trailing whitespace in json dump when using indent

2012-11-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Patch updated. Changing note about YAML is not needed, JSON lefts YAML-compatible even with identation. -- Added file: http://bugs.python.org/file28128/json_indent_separators_default.patch ___ Python tracker

[issue16333] Trailing whitespace in json dump when using indent

2012-11-26 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : Removed file: http://bugs.python.org/file28121/json_indent_separators_default.patch ___ Python tracker ___ ___

[issue16333] Trailing whitespace in json dump when using indent

2012-11-26 Thread anatoly techtonik
anatoly techtonik added the comment: ',' makes lists less readable, directly the opposite of what the *indent* option is for. The *separators* variable is a insufficient solution, because it was not designed to work with indents. Therefore the original solution to strip trailing space when ind

[issue16333] Trailing whitespace in json dump when using indent

2012-11-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The proposed patch changes default *separators* value to (',', ': ') if *indent* is not None. -- Added file: http://bugs.python.org/file28121/json_indent_separators_default.patch ___ Python tracker

[issue16333] Trailing whitespace in json dump when using indent

2012-11-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What you think about default separators will be (', ', ': ') if indent is None and (',', ': ') if indent is not None? This will allow indent options be human-friendly and keep the flexibility to specify arbitrary separators if they needed. -- _

[issue16333] Trailing whitespace in json dump when using indent

2012-11-25 Thread anatoly techtonik
anatoly techtonik added the comment: Trailing whitespace produce visual warnings in diff comparison tools. If you have to read docs on how fix every piece of code that produces readable JSON to avoid this warnings, it is a very-very bad user experience. The argument that by default the output

[issue16333] Trailing whitespace in json dump when using indent

2012-11-25 Thread anatoly techtonik
anatoly techtonik added the comment: Would you mind providing some counter-arguments? -- ___ Python tracker ___ ___ Python-bugs-list m

[issue16333] Trailing whitespace in json dump when using indent

2012-11-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I don't think the code should fixed. You can use separators=(',', ': ') with indentation. Perhaps the documentation should contains such suggestion. -- ___ Python tracker __

[issue16333] Trailing whitespace in json dump when using indent

2012-11-24 Thread anatoly techtonik
anatoly techtonik added the comment: Nice conflict case for explaining why perfect API is not here. Because ', ' is now used as an item separator inline and separator for items that span multiple lines, we get trailing whitespace. If ',' is used, items will collide. To resolve this conflict de

[issue16333] Trailing whitespace in json dump when using indent

2012-10-28 Thread Zach Mathew
Zach Mathew added the comment: To Ezio's first point ... yes, I was wondering if trailing whitespace should be left alone in the case of an explicitly defined separator. However, this behavior seems a little odd to me as I don't see a use case for it (happy to change the patch if there are dif

[issue16333] Trailing whitespace in json dump when using indent

2012-10-28 Thread Ezio Melotti
Ezio Melotti added the comment: It does, and the C accelerator doesn't seem to be used for this. The patch looks good to me, however: 1) it now strips spaces even when explicitly specified in the separator (this might be ok though -- I don't see why someone would need them); 2) I'm not sure if t

[issue16333] Trailing whitespace in json dump when using indent

2012-10-28 Thread Éric Araujo
Éric Araujo added the comment: I think the patch adds tests to a mixin class used to test the Python and the C code, so if it passes then no fix is needed in C. -- nosy: +eric.araujo ___ Python tracker ___

[issue16333] Trailing whitespace in json dump when using indent

2012-10-26 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue16333] Trailing whitespace in json dump when using indent

2012-10-26 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue16333] Trailing whitespace in json dump when using indent

2012-10-26 Thread R. David Murray
R. David Murray added the comment: Thanks for the report and patch. I think we'll need a fix for the C version, too (unless it doesn't have the bug). -- nosy: +r.david.murray stage: -> patch review versions: -Python 2.6, Python 3.1, Python 3.5 ___

[issue16333] Trailing whitespace in json dump when using indent

2012-10-26 Thread Zach Mathew
New submission from Zach Mathew: When using the indent option in json.JSONEncoder, extra trailing whitespace (preceding the newline) is added to list and dict items. For example: >>> import json >>> json.dumps(['foo', 'bar'], indent=1) '[\n "foo", \n "bar"\n]' Notice the blank space between "