This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author giampaolo.rodola
Recipients Arfrever, amaury.forgeotdarc, denilsonsa, giampaolo.rodola, loewis, neologix, pitrou, rosslagerwall, zbysz
Date 2012-01-02.13:55:32
SpamBayes Score 1.5447867e-09
Marked as misclassified No
Message-id <1325512534.29.0.621067522119.issue13609@psf.upfronthosting.co.za>
In-reply-to
Content
What I would do:

- build the namedtuple in Python rather than in C
- I don't particularly like CamelCased names for nametuples (I would use "size" instead of "TerminalSize")
- on UNIX, the ioctl() stuff can be done in python rather than in C
- use C only on Windows to deal with GetStdHandle/GetConsoleScreenBufferInfo; function name should be accessed as nt._get_terminal_size similarly to what we did for shutil.disk_usage in issue12442.
- do not raise NotImplementedError; if the required underlying functions are not available os.get_terminal_size should not exists in the first place (same as we did for shutil.disk_usage / issue12442)


Also, I'm not sure I like fallback=(80, 25) as default, followed by:

        try:
            size = query_terminal_size(sys.__stdout__.fileno())
        except OSError:
            size = TerminalSize(fallback)

That means we're never going to get an exception.
Instead I would:
- provide fallback as None
- let OSError propate unless fallback is not None
History
Date User Action Args
2012-01-02 13:55:34giampaolo.rodolasetrecipients: + giampaolo.rodola, loewis, amaury.forgeotdarc, pitrou, Arfrever, zbysz, denilsonsa, neologix, rosslagerwall
2012-01-02 13:55:34giampaolo.rodolasetmessageid: <1325512534.29.0.621067522119.issue13609@psf.upfronthosting.co.za>
2012-01-02 13:55:33giampaolo.rodolalinkissue13609 messages
2012-01-02 13:55:32giampaolo.rodolacreate