Backspace does not erase in stdout

Grant Edwards invalid at invalid.invalid
Mon Dec 5 12:40:38 EST 2011


On 2011-12-05, Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
> On Mon, 05 Dec 2011 16:23:55 +0000, Grant Edwards wrote:
>
>> On 2011-12-05, Chris Angelico <rosuav at gmail.com> wrote:
>>> On Tue, Dec 6, 2011 at 3:09 AM, Steven D'Aprano
>>><steve+comp.lang.python at pearwood.info> wrote:
>>>>
>>>> Is there a way to erase the character other than backspacing, writing
>>>> a space, then backspacing again? That feels inelegant.
>>>
>>> Emitting "\b \b" is one very common way to do a destructive backspace.
>>> Inelegant? Perhaps, but a common inelegance.
>> 
>> That's pretty much the only way I've seen it done for the past 25 years.
>> 
>> What would be more elegant?
>
> For backspace to actually backspace, and not just move the cursor.

Ah, but "just move the cursor" is what backspace has always meant. 
It's been that way for 100 years -- since the days of typewriters and
teletypes.  ;)

> Thanks for those who answered, I guess I'll just do the backspace,
> space, backspace dance.

After thinking a while, I do remember one program I ran across
recently that when you hit backspace would erase the entire line, then
rewrite the entire line stopping one character short of where it was
before.  Even at network speeds it was noticable when the link was
encrypted.

-- 
Grant Edwards               grant.b.edwards        Yow! Inside, I'm already
                                  at               SOBBING!
                              gmail.com            



More information about the Python-list mailing list