Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
edc9312f
Commit
edc9312f
authored
Jul 06, 2000
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simple-minded readline section doc based upon module's doc strings.
parent
c18b00e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
0 deletions
+90
-0
Doc/lib/libreadline.tex
Doc/lib/libreadline.tex
+90
-0
No files found.
Doc/lib/libreadline.tex
0 → 100644
View file @
edc9312f
\section
{
\module
{
readline
}
---
Expose GNU readline functionality to Python
}
\declaremodule
{
builtin
}{
readline
}
\sectionauthor
{
Skip Montanaro
}{
skip@mojam.com
}
\modulesynopsis
{
GNU Readline in Python.
}
\platform
{
UNIX
}
The
\module
{
readline
}
module defines a number of functions used either
directly or from the
\module
{
rlcompleter
}
module to facilitate completion
and history file read and write from the Python interpreter.
The
\module
{
readline
}
module defines the following functions:
\begin{funcdesc}
{
parse
_
and
_
bind
}{
string
}
Parse and execute single line of a readline init file.
\end{funcdesc}
\begin{funcdesc}
{
get
_
line
_
buffer
}{}
Return the current contents of the line buffer.
\end{funcdesc}
\begin{funcdesc}
{
insert
_
text
}{
string
}
Insert text into the command line.
\end{funcdesc}
\begin{funcdesc}
{
read
_
init
_
file
}{
\optional
{
filename
}}
Parse a readline initialization file.
The default filename is the last filename used.
\end{funcdesc}
\begin{funcdesc}
{
read
_
history
_
file
}{
\optional
{
filename
}}
Load a readline history file.
The default filename is ~/.history.
\end{funcdesc}
\begin{funcdesc}
{
write
_
history
_
file
}{
\optional
{
filename
}}
Save a readline history file.
The default filename is ~/.history.
\end{funcdesc}
\begin{funcdesc}
{
set
_
completer
}{
\optional
{
function
}}
Set or remove the completer function.
The function is called as function(text, state),
\code
{
for i in [0, 1, 2, ...]
}
until it returns a non-string.
It should return the next possible completion starting with 'text'.
\end{funcdesc}
\begin{funcdesc}
{
get
_
begidx
}{}
Get the beginning index of the readline tab-completion scope.
\end{funcdesc}
\begin{funcdesc}
{
get
_
endidx
}{}
Get the ending index of the readline tab-completion scope.
\end{funcdesc}
\begin{funcdesc}
{
set
_
completer
_
delims
}{
string
}
Set the readline word delimiters for tab-completion.
\end{funcdesc}
\begin{funcdesc}
{
get
_
completer
_
delims
}{}
Get the readline word delimiters for tab-completion.
\end{funcdesc}
\subsection
{
Example
}
\nodename
{
Readline Example
}
The following example demonstrates how to use the
\module
{
readline
}
module's
history reading and writing functions to automatically load and save a
history file named
\code
{
.pyhist
}
from the user's home directory. The code
below would normally be executed automatically during interactive sessions
from the user's PYTHONSTARTUP file.
\begin{verbatim}
>>> import os
>>> histfile = os.path.join(os.environ["HOME"], ".pyhist")
>>> try:
>>> readline.read
_
history
_
file(histfile)
>>> except IOError:
>>> pass
>>> import atexit
>>> atexit.register(readline.write
_
history
_
file, histfile)
>>> del os, histfile
\end{verbatim}
\begin{seealso}
\seemodule
{
rlcompleter
}{
completion of Python identifiers
}
\end{seealso}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment