[issue19105] pprint doesn't use all width
Roundup Robot added the comment: New changeset 6d9520e2223f by Serhiy Storchaka in branch 'default': Updated pprint examples in according to issue #19105. https://hg.python.org/cpython/rev/6d9520e2223f -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19105 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19105] pprint doesn't use all width
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19105 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19105] pprint doesn't use all width
Roundup Robot added the comment: New changeset 7a6671d491da by Serhiy Storchaka in branch 'default': Issue #19105: pprint now more efficiently uses free space at the right. https://hg.python.org/cpython/rev/7a6671d491da -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19105 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19105] pprint doesn't use all width
Serhiy Storchaka added the comment: Resolved conflicts with issue19104. -- Added file: http://bugs.python.org/file37517/pprint_all_width_3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19105 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19105] pprint doesn't use all width
Serhiy Storchaka added the comment: Thank you Antoine for your review. But first variant of the patch doesn't affect an example at the top of this issue, it doesn't change string formatting. The second variant makes string formatting use all free space at the right. With the patch: import pprint print('='*80) # a rule pprint.pprint([' '.join(str(i) for i in range(30))]*2) ['0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ' '29', '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ' '29'] pprint.pprint(' '.join(str(i) for i in range(30))*2) '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ' '25 26 27 28 29']]], [[['0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ' '25 26 27 28 29' Could you please make a review of new patch? -- Added file: http://bugs.python.org/file37308/pprint_all_width_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19105 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19105] pprint doesn't use all width
Serhiy Storchaka added the comment: Could anyone please make a review? -- keywords: +needs review versions: +Python 3.5 -Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19105 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19105] pprint doesn't use all width
Serhiy Storchaka added the comment: Here is a patch. Without patch: pprint.pprint([[0, 0, 0]]*3, width=21) [[0, 0, 0], [0, 0, 0], [0, 0, 0]] With patch: pprint.pprint([[0, 0, 0]]*3, width=21) [[0, 0, 0], [0, 0, 0], [0, 0, 0]] -- keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file31945/pprint_all_width.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19105 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19105] pprint doesn't use all width
New submission from Serhiy Storchaka: pprint not only adds indentation, but also increases right margin for nested items. pprint.pprint([' '.join(str(i) for i in range(30))]*2) ['0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ' '28 29', '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ' '28 29'] pprint.pprint(' '.join(str(i) for i in range(30))*2) '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ' '21 22 23 24 25 26 27 28 29']]], [[['0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ' '21 22 23 24 25 26 27 28 29' As you can see in second example there is a place for at least '21 22 23 ' at the right. In case of multiline representation of nested items pprint can reserve space only at the end of last line and continue inner lines to full width. -- components: Library (Lib) messages: 198475 nosy: fdrake, pitrou, serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: pprint doesn't use all width type: enhancement versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19105 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com