Alternative Python bindings for GNU Readline.
Package Contents
rl exports the following components:
- rl.completer
- Interface to the readline completer. Used to configure the completion
aspects of readline.
- rl.completion
- Interface to the active readline completion. Used to interact
with readline when a completion is in progress.
- rl.history
- Interface to the readline history. Used to read and write history files
and to manipulate history entries.
- rl.readline
- The readline bindings module. Contains everything known from the standard
library plus extensions specific to the rl package. The completer,
completion, and history
objects make use of this module, and you should rarely need to interact
with it directly.
- rl.generator()
- A factory turning any callable into a completion entry function that
can be handed to readline.
- rl.print_exc()
- A decorator printing exceptions to stderr. Useful when writing Python
completions and hooks, as exceptions occurring there are usually
swallowed by the in-between C code.
Readline Completion
Completion is the process initiated when the user presses the TAB key.
It has three phases: Word breaking, match generation, and
match display.
For each phase, readline provides configuration settings and hooks that
allow applications to control the way the library behaves. See the
Completer and Completion
classes for detailed descriptions of available properties.
Call Graph
A calling sequence for filename completion may look like this:
complete_internal()
find_completion_word()
gen_completion_matches()
insert_match()
display_matches()
Readline History
History allows readline to save and later recall lines the user has entered.
The history object provides a list-like interface to the
history buffer as well as functions to persist the history between sessions.