New submission from Nicolas Hug <nio...@gmail.com>:
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? ---------- messages: 326358 nosy: Nicolas Hug priority: normal severity: normal status: open title: pprint ignores the compact parameter for dicts type: behavior versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34798> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com