Message152390
termsize.diff.7:
- shutil.get_terminal_size(): I would prefer columns and lines
variable names instead of "ccc" and "rrr"
- "Right now the values are not cached, but this might change." why
would it be cached? this sentence can just be removed
- I would prefer os.get_terminal_size() instead of
os.query_terminal_size(), I didn't know other function using the verb
"query" in Python
- To keep os simple, os.query_terminal_size() can return a simple,
whereas shutil.get_terminal_size() returns a namedtuple
- test_os.py: use @unittest.skipUnless() on TermsizeTests to check if
os.query_terminal_size() is available
- test.py, test_does_not_crash() catchs OSError, you may only ignore
some error codes, not any. For example, skip the test if stdout is not
a tty
+ try:
+ size = os.query_terminal_size(sys.__stdout__.fileno())
+ except (NameError, OSError):
+ size = os.terminal_size(fallback)
AttributeError should be catched here, not NameError. Or better, check
if os has a query_terminal_size() function.
+.. function:: get_terminal_size(fallback=(columns, lines))
Hum, you may document the default value: (80, 24).
shutil.get_terminal_size() doesn't allow to choose the file
descriptor. Would it be useful to allow to get the size of sys.stderr
or another TTY? |
|
Date |
User |
Action |
Args |
2012-01-31 15:03:28 | vstinner | set | recipients:
+ vstinner, loewis, amaury.forgeotdarc, pitrou, techtonik, giampaolo.rodola, eric.araujo, Arfrever, zbysz, denilsonsa, neologix, rosslagerwall |
2012-01-31 15:03:27 | vstinner | link | issue13609 messages |
2012-01-31 15:03:27 | vstinner | create | |
|