[IPython-dev] History in ipython1
gael.varoquaux at normalesup.org
Mon Jul 21 00:00:11 EDT 2008
I am about to implement saving history between session for my frontend. I
cannot reuse the existing code, as it heavily relies on readline. I had a
look at the pyreadline code, and I don't think I am going to ruese it.
First of all, I would have to extract it from pylreadline, as pyreadline
cannot be installed on a non-windows OS (not only because of its
dependencies, but also because it overrides readline when it is
installed), second there is a lot of stuff I don't need in there.
Before doing this, I want to clean up the history code. I have the
impression that the current History objects where derived from the
history implementation I had sketched almost a year ago. In this
implementation the history cursor was 0 to indicate the last line, and
went up as you would go up the history. In the current version, althought
the docstrings haven't been modified, it is the other way around.
I prefer the way in which last=0, the reason been that with the
exception, and the various code path that can lead to an execution or a
new prompt, or the loading of history, it is easy to loose track of the
number of past executions. Of course, we can always fallback on our feet
by checking the length of the history, and resetting the cursor to that,
but it seems simpler to count from the back. How to people feel about
In addition, I would like to add history loading in the history object,
throught a seperate method. No controverse?
More information about the IPython-dev