cpython: 9a2c891a4333 (original) (raw)
Mercurial > cpython
changeset 99860:9a2c891a4333 2.7
#25991: fix readline example to limit history size. Patch by Daniel Dye. [#25991]
Ezio Melotti ezio.melotti@gmail.com | |
---|---|
date | Mon, 11 Jan 2016 23:30:15 +0200 |
parents | 609226a23086 |
children | 268d13c7e939 c6b5c03183e3 |
files | Doc/library/readline.rst |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-)[+] [-] Doc/library/readline.rst 3 |
line wrap: on
line diff
--- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -214,6 +214,8 @@ normally be executed automatically durin histfile = os.path.join(os.path.expanduser("~"), ".pyhist") try: readline.read_history_file(histfile)
# default history len is -1 (infinite), which may grow unruly[](#l1.7)
except IOError: pass import atexit @@ -244,5 +246,6 @@ support history save/restore. :: atexit.register(self.save_history, histfile)readline.set_history_length(1000)[](#l1.8)
def save_history(self, histfile):
readline.set_history_length(1000)[](#l1.16) readline.write_history_file(histfile)[](#l1.17)