interactave, readline, and insert_text
Christopher T King
squirrel at WPI.EDU
Fri Jul 30 15:20:25 EDT 2004
On Fri, 30 Jul 2004, garett wrote:
> I have also tried readline.redisplay() to the the contents of the line
> buffer to display in the edit line of the interpreter. Does anybody have
> any suggestions as to a technique to put text into the edit line of the
> interactive interpreter from a function so it can be further edited?
The closest thing I can find is to use readline.add_history(). This won't
make your text pop up on the command line, but it will appear at the end
of the history buffer, ready to use.
On an unrelated note, holy crap: I did not know of the existence of
rlcompleter. Let all to whom this module is unknown type the following at
a Unix Python prompt:
import readline
import rlcompleter
readline.parse_and_bind('tab: complete')
and rejoice! :) It just goes to show how many neat things Python does that
you can go years without ever discovering them.
More information about the Python-list
mailing list