I’m using a .pythonsetup file to enable readline history in the manner described in the readline module docs. Normally, history from previous interactive interpreter sessions is available when I start up a new session.
% python
>>> # history available...
However, when using -i or -c, past history is not available. It’s not that readline is disabled: history is available for the current session, but that history will not be saved to the history file.
% python -i myscript.py
>>> # previous history not available
% python -i -c "x = 1"
>>> # previous history not available
This behavior is consistent in Python 2.6, 2.7, and 3.2.
Does anyone know why previous readline history is disabled when using -i or -ic? Is there is a way to configure readline to make history available (and savable) when using -i or -ic?
The man page for my
python2.6saysSince this is how you customized the readline behavior ( http://docs.python.org/py3k/library/readline.html#example ), it doesn’t take effect when you use that option.