On Sat, Sep 2, 2017 at 8:53 PM, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > The problem is that after the message is printed, the REPL's prompt is > disrupted. This is especially annoying when I'm in the middle of typing a > line. > This is just a cosmetic flaw, but it would be nice if I could tell Python to > redraw the current line. For example, using _ to indicate the position of the > cursor, this is what happens now: > > py> class K: > ... attribute =It is Sat Sep 2 20:48:39 2017 and 2+2 is 4 > _ > > > This is what I'd prefer: > > py> class K: > ... attribute =It is Sat Sep 2 20:48:39 2017 and 2+2 is 4 > ... attribute =_ >
This is a common problem with a lot of programs. I'd like a solution too; the place I'd go looking would be readline, as that's where most of the work is going to be happening. (Also, if it's added as a readline feature, it won't break redirection or anything like that, as it's specifically a human-interaction thing.) There are three parts to the console output: the prompt ("..."), your input ("attribute ="), and the output message. Only readline knows exactly which parts go where. ChrisA -- https://mail.python.org/mailman/listinfo/python-list