[issue19103] Use pprint in displayhook
Serhiy Storchaka added the comment: (in the patch, import of sys and pprint should be done once at module level and not repeated with every line of interactive output). See a comment at the start of the Lib/_sitebuiltins.py file. Yes, importing sys in the function is redundant. For instance, try list(range(40)) with the two options. Well, I have opened issue19132 for this. This is not to mention doctest and other test breakage. AFAIK doctests doesn't test output longer than 80 characters. I believe the majority consensus on python-ideas was to reject this until pprint is much improved, and then reconsider. There are other pprint-related issue which are opened long time without any progress (e.g. issue7434). I intend making progress on issues which are required for fixing pprint enough to be reasonable replacement for displayhook. -- dependencies: +Add compact mode to pprint ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19103 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19103] Use pprint in displayhook
Terry J. Reedy added the comment: (in the patch, import of sys and pprint should be done once at module level and not repeated with every line of interactive output). pprint.pprint() produces more human readable output than print(repr()) which is used in sys.displayhook() Only sometimes, and when it is not, the result can be *much* worse. For instance, try list(range(40)) with the two options. On windows, pprint.pprint(list(range(300))) will not even fit in the default 300 line output buffer of the standard interpreter. This is not to mention doctest and other test breakage. I believe the majority consensus on python-ideas was to reject this until pprint is much improved, and then reconsider. I agree with that. As I said on the list, I think this is more feasible for environments (like Idle) where it could be turned on and off, or invoked to re-display an output where pprint *would* be better. -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19103 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19103] Use pprint in displayhook
Changes by Terry J. Reedy tjre...@udel.edu: -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19103 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19103] Use pprint in displayhook
New submission from Serhiy Storchaka: pprint.pprint() produces more human readable output than print(repr()) which is used in sys.displayhook(). The proposed patch changes sys.displayhook in site.py. You still can access original displayhook as sys.__displayhook__. -- files: displayhook_pprint.patch keywords: patch messages: 198468 nosy: fdrake, pitrou, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: Use pprint in displayhook type: enhancement versions: Python 3.4 Added file: http://bugs.python.org/file31883/displayhook_pprint.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19103 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19103] Use pprint in displayhook
Serhiy Storchaka added the comment: In second patch the COLUMNS environment variable is used to determine pprint's width. -- Added file: http://bugs.python.org/file31885/displayhook_pprint_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19103 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19103] Use pprint in displayhook
Changes by Serhiy Storchaka storch...@gmail.com: -- dependencies: +Use backslashreplace in pprint, pprint produces invalid output for long strings ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19103 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com