i prefer, where possible, to avoid running another process just to get a little bit of information. so i like the idea of doing system or library (module in python) calls. i have invoked stty often in my bash scripts. but if i don't have to in python, i like that. in on script i needed the host's IP address. but i needed it soon, so i invoked the ifconfig command and got it from there. not all scripts do things the same way. but if i do on thing quite a lot, i make it into a function or module or command or whatever it needs.
my get_terminal_geometry() function would have had a gap of 3.0 to 3.2 since it had code to get the geometry itself in version 2. now i will test for version 3.3 or if os is already imported, see if 'get_terminal_size' in dir(os).
so, why should i be using shutil.get_terminal_size() instead?
(Jul-15-2018, 09:41 AM)stranac Wrote: Looks like os.get_terminal_size() was added in python 3.3.
It also looks like you should be using shutil.get_terminal_size() instead.
my get_terminal_geometry() function would have had a gap of 3.0 to 3.2 since it had code to get the geometry itself in version 2. now i will test for version 3.3 or if os is already imported, see if 'get_terminal_size' in dir(os).
so, why should i be using shutil.get_terminal_size() instead?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.