Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(33577)

Side by Side Diff: Doc/library/readline.rst

Issue 12833: raw_input misbehaves when readline is imported
Patch Set: Created 5 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`readline` --- GNU readline interface 1 :mod:`readline` --- GNU readline interface
2 ========================================== 2 ==========================================
3 3
4 .. module:: readline 4 .. module:: readline
5 :platform: Unix 5 :platform: Unix
6 :synopsis: GNU readline support for Python. 6 :synopsis: GNU readline support for Python.
7 .. sectionauthor:: Skip Montanaro <skip@pobox.com> 7 .. sectionauthor:: Skip Montanaro <skip@pobox.com>
8 8
9 9
10 The :mod:`readline` module defines a number of functions to facilitate 10 The :mod:`readline` module defines a number of functions to facilitate
11 completion and reading/writing of history files from the Python interpreter. 11 completion and reading/writing of history files from the Python interpreter.
12 This module can be used directly or via the :mod:`rlcompleter` module. Settings 12 This module can be used directly or via the :mod:`rlcompleter` module. Settings
13 made using this module affect the behaviour of both the interpreter's 13 made using this module affect the behaviour of both the interpreter's
14 interactive prompt and the prompts offered by the built-in :func:`input` 14 interactive prompt and the prompts offered by the built-in :func:`input`
15 function. 15 function.
16
17 .. caution::
18
19 The following will result in deletion of the 'Hello' when a backspace is type d.::
20
21 import sys, readline
22 sys.stdout.write('Hello ')
23 input()
24
25 It is recommended to directly use the :func:`input` function.::
26
27 import readline
28 input('Hello ')
16 29
17 .. note:: 30 .. note::
18 31
19 On MacOS X the :mod:`readline` module can be implemented using 32 On MacOS X the :mod:`readline` module can be implemented using
20 the ``libedit`` library instead of GNU readline. 33 the ``libedit`` library instead of GNU readline.
21 34
22 The configuration file for ``libedit`` is different from that 35 The configuration file for ``libedit`` is different from that
23 of GNU readline. If you programmatically load configuration strings 36 of GNU readline. If you programmatically load configuration strings
24 you can check for the text "libedit" in :const:`readline.__doc__` 37 you can check for the text "libedit" in :const:`readline.__doc__`
25 to differentiate between GNU readline and libedit. 38 to differentiate between GNU readline and libedit.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if hasattr(readline, "read_history_file"): 241 if hasattr(readline, "read_history_file"):
229 try: 242 try:
230 readline.read_history_file(histfile) 243 readline.read_history_file(histfile)
231 except FileNotFoundError: 244 except FileNotFoundError:
232 pass 245 pass
233 atexit.register(self.save_history, histfile) 246 atexit.register(self.save_history, histfile)
234 247
235 def save_history(self, histfile): 248 def save_history(self, histfile):
236 readline.write_history_file(histfile) 249 readline.write_history_file(histfile)
237 250
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+