Is shutil.get_terminal_size useless?
Steve D'Aprano
steve+python at pearwood.info
Wed Feb 1 20:28:33 EST 2017
On Sat, 28 Jan 2017 11:53 pm, Peter Otten wrote:
[...]
>> I see that as "Hey look, we can fool shutil into returning
>> absolute garbage instead of the terminal size!"
>
> There are valid reasons for temporarily altering the number of columns,
> like writing to a file or preparing a code sample.
Hmmm... I hadn't thought of that. You're right that there are scenarios
where you might wish to tell a process to use a different number of columns
(or even lines). Good point.
I'm not sure that the given API is a good one, but I accept that the COLUMNS
+ LINES environment variables could be used to override the actual terminal
size.
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
More information about the Python-list
mailing list