Availability: Unix.
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 execute single line of a readline init file.
-
-
Return the current contents of the line buffer.
-
-
Insert text into the command line.
-
-
Parse a readline initialization file.
The default filename is the last filename used.
-
-
Load a readline history file.
The default filename is ~/.history.
-
-
Save a readline history file.
The default filename is ~/.history.
-
-
Return the desired length of the history file. Negative values imply
unlimited history file size.
-
-
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 or remove the startup_hook function. If function is specified,
it will be used as the new startup_hook function; if omitted or
None
, any hook function already installed is removed. The
startup_hook function is called with no arguments just
before readline prints the first prompt.
-
-
Set or remove the pre_input_hook function. If function is specified,
it will be used as the new pre_input_hook function; if omitted or
None
, any hook function already installed is removed. The
pre_input_hook function is called with no arguments after the first prompt
has been printed and just before readline starts reading input characters.
-
-
Set or remove the completer function. If function is specified,
it will be used as the new completer function; if omitted or
None
, any completer function already installed is removed. The
completer function is called as function(text,
state)
, for state in 0
, 1
, 2
, ...,
until it returns a non-string value. It should return the next
possible completion starting with text.
-
-
Get the completer function, or
None
if no completer function
has been set.
New in version 2.3.
-
-
Get the beginning index of the readline tab-completion scope.
-
-
Get the ending index of the readline tab-completion scope.
-
-
Set the readline word delimiters for tab-completion.
-
-
Get the readline word delimiters for tab-completion.
-
-
Append a line to the history buffer, as if it was the last line typed.
See Also:
- Module rlcompleter:
- Completion of Python identifiers at the
interactive prompt.
Subsections
See About this document... for information on suggesting changes.