Baffled by readline module

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 9 19:41:07 EST 2023


On 10/03/23 11:43 am, Chris Angelico wrote:
> import readline
> print("Pseudo-prompt: ", end="")
> msg1 = input()
> msg2 = input("Actual prompt: ")
> print(repr(msg1))
> print(repr(msg2))
> 
> At each of the prompts, type a bit of text, then backspace it all the
> way. The actual prompt will remain, but the pseudo-prompt will get
> cleared off. There'll be other small differences too.

Hmmm, so it seems that merely importing readline does change
things a little bit.

This is rather nasty. I'd go so far as to call it a bug in
gnu readline -- it shouldn't be erasing something that the
user didn't type in.

-- 
Greg


More information about the Python-list mailing list