This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bob.ippolito
Recipients bob.ippolito, dhimmel, ezio.melotti, methane, r.david.murray, rhettinger, serhiy.storchaka
Date 2017-03-16.18:21:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1489688480.13.0.82291460542.issue29636@psf.upfronthosting.co.za>
In-reply-to
Content
Probably the best thing we could do here is to mirror the options available in similar tools, such as jq: https://stedolan.github.io/jq/manual/#Invokingjq

The relevant options here would be:

    --indent
    --tab
    --compact-output
    --sort-keys

The default indent in jq is 2, which I tend to prefer these days, but maybe 4 is still appropriate given PEP 8:

    $ echo '[{}, {"a": "b"}, 2, 3, 4]' | jq
    [
      {},
      {
        "a": "b"
      },
      2,
      3,
      4
    ]


This is how jq interprets --compact-output:

    $ echo '[{}, {"a": "b"}, 2, 3, 4]' | jq --compact-output
    [{},{"a":"b"},2,3,4]


I do not think that it's worth having the command-line tool cater to people that want to indent in other ways (e.g. using a string that isn't all spaces or a single tab).
History
Date User Action Args
2017-03-16 18:21:20bob.ippolitosetrecipients: + bob.ippolito, rhettinger, ezio.melotti, r.david.murray, methane, serhiy.storchaka, dhimmel
2017-03-16 18:21:20bob.ippolitosetmessageid: <1489688480.13.0.82291460542.issue29636@psf.upfronthosting.co.za>
2017-03-16 18:21:20bob.ippolitolinkissue29636 messages
2017-03-16 18:21:20bob.ippolitocreate