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.
Created on 2013年09月29日 20:05 by serhiy.storchaka, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| pprint_compact.patch | serhiy.storchaka, 2013年09月30日 18:07 | review | ||
| pprint_compact_2.patch | serhiy.storchaka, 2013年09月30日 19:56 | review | ||
| pprint_compact_3.patch | serhiy.storchaka, 2013年10月01日 15:17 | review | ||
| Messages (14) | |||
|---|---|---|---|
| msg198641 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年09月29日 20:05 | |
pprint produces not very nice output for collections with a large number of short elements (see msg198556). For example pprint.pprint(list(range(40))) outputs more than 40 short lines, while print(repr(list(range(40)))) takes only 2 lines on 80-column terminal. I propose to add new boolean option "compact". With compact=True pprint will try combine as much short one-line subelements in one line as possible. Every multiline element will be printed on separated lines. Examples: >>> pprint.pprint(list(range(40)), width=50, compact=True) [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, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39] >>> pprint.pprint(['one string', 'other string', 'very very long string which continued on several lines', 'and again', 'and again', 'and again', 'and again'], width=50, compact=True) ['one string', 'other string', 'very very long string which is continued on ' 'several lines', 'and again', 'and again', 'and again', 'and again'] |
|||
| msg198643 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2013年09月29日 20:16 | |
I think it looks good on the principle. |
|||
| msg198702 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年09月30日 14:48 | |
I like it. If it isn't too difficult, I'd suggest that compact mode also indent the string continuation lines: ['one string', 'other string', 'very very long string which is continued on ' 'several lines', 'and again', 'and again', 'and again', 'and again'] |
|||
| msg198711 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年09月30日 18:07 | |
Here is a patch. Please review and correct the documentation. |
|||
| msg198713 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年09月30日 18:09 | |
> I'd suggest that compact mode also indent the string continuation lines: Please open new issue for this. |
|||
| msg198717 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年09月30日 18:51 | |
As noted in the review, I'm not as keen on having dictionaries displayed in compact form. |
|||
| msg198726 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年09月30日 19:56 | |
Updated patch addresses David's comments. Thank you David. > As noted in the review, I'm not as keen on having dictionaries displayed in compact form. This makes sense. If no one will argue for compactifying mappings I'll remove this part of the patch. |
|||
| msg198789 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2013年10月01日 15:05 | |
> As noted in the review, I'm not as keen on having dictionaries displayed > in compact form. Agreed with David. |
|||
| msg198790 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年10月01日 15:17 | |
Updated patch doesn't compactify dicts. |
|||
| msg198821 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年10月02日 08:57 | |
New changeset ae0306c8f7a3 by Serhiy Storchaka in branch 'default': Issue #19132: The pprint module now supports compact mode. http://hg.python.org/cpython/rev/ae0306c8f7a3 |
|||
| msg198836 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2013年10月02日 13:07 | |
Sorry I missed this on the review, but you are missing versionchanged tags (or versionadded, whichever you prefer :) and a what's new entry. |
|||
| msg198855 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2013年10月02日 17:17 | |
I had added a what's new entry. |
|||
| msg198858 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年10月02日 18:40 | |
New changeset 6e7b1aadea2f by Serhiy Storchaka in branch 'default': Issue #19132: Add versionchanged tags. http://hg.python.org/cpython/rev/6e7b1aadea2f |
|||
| msg223761 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2014年07月23日 19:01 | |
New changeset 60301b9982b2 by Terry Jan Reedy in branch '2.7': Issue #21597: Turtledemo text pane can now be widened to view or copy complete http://hg.python.org/cpython/rev/60301b9982b2 New changeset 0fb515063324 by Terry Jan Reedy in branch '3.4': Issue #21597: Turtledemo text pane can now be widened to view or copy complete http://hg.python.org/cpython/rev/0fb515063324 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:51 | admin | set | github: 63331 |
| 2014年07月23日 19:01:55 | python-dev | set | messages: + msg223761 |
| 2013年10月02日 18:40:52 | python-dev | set | messages: + msg198858 |
| 2013年10月02日 17:17:23 | serhiy.storchaka | set | messages: + msg198855 |
| 2013年10月02日 13:07:18 | r.david.murray | set | messages: + msg198836 |
| 2013年10月02日 08:58:22 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2013年10月02日 08:57:38 | python-dev | set | nosy:
+ python-dev messages: + msg198821 |
| 2013年10月01日 15:17:24 | serhiy.storchaka | set | files:
+ pprint_compact_3.patch messages: + msg198790 |
| 2013年10月01日 15:05:32 | pitrou | set | messages: + msg198789 |
| 2013年09月30日 19:56:06 | serhiy.storchaka | set | files:
+ pprint_compact_2.patch messages: + msg198726 |
| 2013年09月30日 18:51:08 | r.david.murray | set | messages: + msg198717 |
| 2013年09月30日 18:09:10 | serhiy.storchaka | set | messages: + msg198713 |
| 2013年09月30日 18:07:15 | serhiy.storchaka | set | files:
+ pprint_compact.patch keywords: + patch messages: + msg198711 stage: needs patch -> patch review |
| 2013年09月30日 14:48:19 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg198702 |
| 2013年09月29日 20:22:18 | serhiy.storchaka | link | issue19103 dependencies |
| 2013年09月29日 20:16:43 | pitrou | set | nosy:
+ pitrou messages: + msg198643 |
| 2013年09月29日 20:05:49 | serhiy.storchaka | create | |