[IPython-dev] Strange behavior of history with multi-line recalls

Fernando Perez fperez.net at gmail.com
Fri Nov 2 20:04:24 EDT 2007


Hi all,

I was trying to reuse some previous input and kept running into
strange problems.  It turns out that my history looks like this:

49:
for k in outcnew[2]:
    nn = norm(outcnew[k]-outcold[k])
    print k,'->',nn

50: outcnew[2].keys()
51: sn=set(outcnew[2].keys())
52: so=set(outcold[2].keys())
53: sn-so
54: so-sn
55: exec In[48]
56: print In[48]
57: print In[49]
58: exec In[49]
59: for k in outcnew[2]:
60:     nn = norm(outcnew[2][k]-outcold[2][k])
61:
    print k,'->',nn

62: for k in outcnew[sc]:
63:     nn = norm(outcnew[sc][k]-outcold[sc][k])
64:
    print k,'->',nn

65: sc

etc.

Things like lines 59-60 or 62-64 shouldn't happen.  Normally whenever
you type multi-line input, it registers as a single input line number.
 The way these ended in there was because I'd recalled previous
multi-line input and edited it, point at which somehow the history
list ended up filled with more than one entry.

Ideas?

Cheers,

f



More information about the IPython-dev mailing list