[issue29996] Use terminal width by default in pprint

2021-03-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Closing then. I'll just add my implementation in my .pythonrc.py. -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue29996] Use terminal width by default in pprint

2021-03-20 Thread Eryk Sun
Change by Eryk Sun : -- versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.7 ___ Python tracker ___ ___ Python-bugs-list maili

[issue29996] Use terminal width by default in pprint

2021-03-20 Thread Eryk Sun
Change by Eryk Sun : -- Removed message: https://bugs.python.org/msg291198 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue29996] Use terminal width by default in pprint

2017-09-01 Thread Éric Araujo
Éric Araujo added the comment: I was about to open the same issue! I tend to print nested data structures for debugging; having lists take up a lot of vertical screen estate and leave unused all the horizontal space is an annoyance, so that I regularly have to go back and add the width param.

[issue29996] Use terminal width by default in pprint

2017-04-06 Thread Xiang Zhang
Xiang Zhang added the comment: I use screens and usually like to open a terminal to fill the screen. One of my use case is changed by this patch from: 'manufacturers_specifications': '2U 2*Intel Xeon E5-2603 4核 8*8G ' 'DDR3-1333 ECC 1.35

[issue29996] Use terminal width by default in pprint

2017-04-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Thus, you keep your default behavior of width=80, while I just add the following to my PYTHONSTARTUP file: from functools import partial from pprint import pprint, AUTOWIDTH pprint = partial(pprint, width=AUTOWIDTH) and we both get what we want. --

[issue29996] Use terminal width by default in pprint

2017-04-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: If you want the dir listing output in a column, you're just relying on your listing to be wider than 80 characters, it still doesn't columnize unless you pass that point. Personally, I feel if I made the terminal wider, I'd like to actually use that width. I

[issue29996] Use terminal width by default in pprint

2017-04-06 Thread Fred L. Drake, Jr.
Fred L. Drake, Jr. added the comment: I wouldn't go so far as to say it's never come up; it's something I've thought about a number of times, and I've waffled on it a few times. It's not fundamentally unreasonable to want it to adapt to the current terminal window, though I think it would be i

[issue29996] Use terminal width by default in pprint

2017-04-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: One other thought: This module has a very long history. It is widely used, has had many feature requests and bug reports, but this particular feature has never been requested. That should tell us something about whether there is an actual need. To me, th

[issue29996] Use terminal width by default in pprint

2017-04-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: After more thought, put me down for -1 on this proposal. I use pprint() quite a bit when teaching Python courses. I expect that 100% of the time that users are following the live examples, I will get stopped and asked why their output is different from

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Eryk Sun
Eryk Sun added the comment: > Though I don't have any idea if it works on Windows, but it seems > properly factored. Generally it should. However, os.get_terminal_size is unnecessarily limited to the standard handles with a hard-coded mapping 0 => StandardInput, 1 => StandardOutput, and 2 =>

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: * In IDLE sys.stdout.isatty() returns True, but sys.stdout.fileno() raises an exception. Terminal width can't be determined and the default 80 is used. * You always can pass explicit width to pprint. This may be needed even with default width 80. Now on wide

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Fred L. Drake, Jr.
Fred L. Drake, Jr. added the comment: This is not a problem for doctests, since the output stream is not a terminal; the check for terminal-ness seems reasonable. (Though I don't have any idea if it works on Windows, but it seems properly factored.) -- ___

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: Some thoughts: * I'm not sure the terminal width will always be knowable, for example when using IDLE. * I often need smaller widths when printing short dicts and lists. The smaller widths better show the parallel structure. I think having it fill the wi

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1176 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue29996] Use terminal width by default in pprint

2017-04-05 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: pprint() uses width=80 by default. But default output stream is sys.stdout which often is connected to a terminal, and terminals now usually have larger width than 80 columns. Proposed patch change the default value of the width parameter in pprint(). If