readline, rlcompleter

David M. Cooke cookedm+news at
Tue Jan 11 22:11:07 CET 2005

michele.simionato at writes:

> This a case where the documentation is lacking. The standard library
> documentation
> ( gives
> this example
> try:
> import readline
> except ImportError:
> print "Module readline not available."
> else:
> import rlcompleter
> readline.parse_and_bind("tab: complete")
> but I don't find a list of recognized key bindings. For instance, can I
> would
> like to bind shift-tab to rlcompleter, is that possible? Can I use
> function
> keys? I did various attempt, but I did not succed :-(
> Is there any readline-guru here with some good pointers?
> Michele Simionato

Basically, you could use any key sequence that is sent to the terminal. So
shift-tab is out (that's not sent as a key to any terminal program).

Function keys would have to be specified as the key sequence sent by a
function key ("\e[11~" for F1, for instance).

Have a look at the readline info page, or the man page. The syntax of
readline.parse_and_bind is the same as that of an inputrc file.

|David M. Cooke

More information about the Python-list mailing list