Note. This is checked only with python 2.
Credits: https://wiki.python.org/moin/PdbRcIdea
pdb uses readline, so we can instruct readline to save history:
.pdbrc
# NB: This file only works with single-line statements import os execfile(os.path.expanduser("~/.pdbrc.py"))
.pdbrc.py
def _pdbrc_init(): # Save history across sessions import readline histfile = ".pdb-pyhist" try: readline.read_history_file(histfile) except IOError: pass import atexit atexit.register(readline.write_history_file, histfile) readline.set_history_length(500) _pdbrc_init() del _pdbrc_init
source share