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 Nicolas Hug
Recipients Nicolas Hug
Date 2018-09-25.14:45:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537886741.82.0.545547206417.issue34798@psf.upfronthosting.co.za>
In-reply-to
Content
Dict representations that exceed the line width are printed with one line per key-value pair, ignoring the compact=True parameter:

>>> pprint.pprint({i: 0 for i in range(15)}, compact=True)
{0: 0,
 1: 0,
 2: 0,
 3: 0,
 4: 0,
 5: 0,
 6: 0,
 7: 0,
 8: 0,
 9: 0,
 10: 0,
 11: 0,
 12: 0,
 13: 0,
 14: 0}

Expected behavior:

>>> pprint.pprint({i: 0 for i in range(15)}, compact=True)
{0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0, 11: 0,
 12: 0, 13: 0, 14: 0}

Note that lists are correctly compacted, and that dicts that don't exceed line width are printed on a single line, regardless on the compact parameter.

I could try to work on that if needed?
History
Date User Action Args
2018-09-25 14:45:41Nicolas Hugsetrecipients: + Nicolas Hug
2018-09-25 14:45:41Nicolas Hugsetmessageid: <1537886741.82.0.545547206417.issue34798@psf.upfronthosting.co.za>
2018-09-25 14:45:41Nicolas Huglinkissue34798 messages
2018-09-25 14:45:41Nicolas Hugcreate