symbolic links, aliases, cls clear

Floyd L. Davidson floyd at apaflo.com
Wed Apr 12 15:09:29 EDT 2006


Keith Thompson <kst-u at mib.org> wrote:
>floyd at apaflo.com (Floyd L. Davidson) writes:
>> af.dingo at gmail.com wrote:
>>>If I may recommend an alternative,
>>>
>>>print "\033[H\033[J"
>>>
>>>the ansi sequence to clear the screen.
>>
>> Or so you would hope (however, that is *not* what you have listed!).
>>
>> Unfortunately, it is poor practice to hard code such sequences.
>> Instead the proper sequence should be obtained from the
>> appropriate database (TERMINFO or TERMCAP), and the easy way to
>> do that is,
>>
>>    tput clear
>
>(Or "clear".)

But /clear/ merely uses "tput clear".

>On the other hand, I think it's been at least a decade since I've used
>a terminal or emulator that's not VT100-compatible (i.e., accepts ANSI
>control sequences).
>
>Of course, I'll run into one the day after I start writing code that
>depends on that assumption.

However, if you check out the various TERMINFO database entries for an
assortment of "VT100-compatible" terminals, you *will* find variation!

Plus, if a user has customized a terminal database, for who knows what
reason...

-- 
Floyd L. Davidson            <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska)                         floyd at apaflo.com



More information about the Python-list mailing list