GNU Info

Info Node: (python2.1-lib.info)readline

(python2.1-lib.info)readline


Next: rlcompleter Prev: zipfile Up: Optional Operating System Services
Enter node , (file) or (file)node

GNU readline interface
======================

This manual section was written by Skip Montanaro <skip@mojam.com>.
GNU readline support for Python.

The `readline' module defines a number of functions used either
directly or from the `rlcompleter' module to facilitate completion and
history file read and write from the Python interpreter.

The `readline' module defines the following functions:

`parse_and_bind(string)'
     Parse and execute single line of a readline init file.

`get_line_buffer()'
     Return the current contents of the line buffer.

`insert_text(string)'
     Insert text into the command line.

`read_init_file([filename])'
     Parse a readline initialization file.  The default filename is the
     last filename used.

`read_history_file([filename])'
     Load a readline history file.  The default filename is
     `~{}/.history'.

`write_history_file([filename])'
     Save a readline history file.  The default filename is
     `~{}/.history'.

`get_history_length()'
     Return the desired length of the history file.  Negative values
     imply unlimited history file size.

`set_history_length(length)'
     Set the number of lines to save in the history file.
     `write_history_file()' uses this value to truncate the history
     file when saving.  Negative values imply unlimited history file
     size.

`set_completer([function])'
     Set or remove the completer function.  The completer function is
     called as `FUNCTION(TEXT, STATE)', `for i in [0, 1, 2, ...]' until
     it returns a non-string.  It should return the next possible
     completion starting with TEXT.

`get_begidx()'
     Get the beginning index of the readline tab-completion scope.

`get_endidx()'
     Get the ending index of the readline tab-completion scope.

`set_completer_delims(string)'
     Set the readline word delimiters for tab-completion.

`get_completer_delims()'
     Get the readline word delimiters for tab-completion.

See also:
     Note: rlcompleter Completion of Python identifiers at the
     interactive prompt.

Example 6

automatically generated by info2www version 1.2.2.9