Query regarding sys.stdout.write

Chris Angelico rosuav at gmail.com
Sun Jun 7 23:19:29 EDT 2015


On Mon, Jun 8, 2015 at 11:56 AM, Cameron Simpson <cs at zip.com.au> wrote:
> If you want do do this version portably, hook into the Python curses module
> and get the result of curses.tigetstr('el'). If that returns None, the
> terminal does not support clear-to-end-of-line and you should use the
> spaces-overwrite technique. But if it returns a string, you can write that
> string, whatever it is, to erase to the end of the line.
>
> Most modern terminals are ANSI supersets, but the terminfo database has a
> huge suite of descriptions of terminals, and this will get your the right
> sequence, whatever that may be, for your current terminal.

Fair point. I hard-coded it in LetMeKnow because I didn't know of a
way to access terminfo in Python; thanks for the tip. Although...

> Of course, reaching for the curses module is massive overkill in a sense,
> but it is the only way to consult terminfo in the Python stdlib.

... yeah, massive overkill.

> But I have to say, I "non-concur." (Non-concur was a term I learned at
> IBM. IBM seemed to be a breeding ground for making up words and
> phrases, turning verbs into nouns, etc. "Non-concur" seems to be for
> those times when saying "I disagree" just isn't strong enough!)
>        - Robert D. Seidman <robert at clark.net>

Heh. That is so true. My favourite piece of IBM-speak comes from the
OS/2 config.sys directive "REIPL=C", which causes fatal errors to be
logged to C:\POPUPLOG.OS2 ... of course.

http://rosuav.blogspot.com.au/2011/01/reiplophobia.html

ChrisA



More information about the Python-list mailing list