[Ipython-tickets] [IPython] #188: _ih object getting modified by calls to %hist
IPython
ipython-tickets@scipy....
Wed Sep 26 12:52:25 CDT 2007
#188: _ih object getting modified by calls to %hist
---------------------+------------------------------------------------------
Reporter: fperez | Owner: vivainio
Type: defect | Status: new
Priority: normal | Milestone:
Component: ipython | Version:
Severity: normal | Keywords:
---------------------+------------------------------------------------------
Consider the following:
{{{
In [1]: 44
Out[1]: 44
In [2]: _ih
Out[2]: ['\n', u'44\n', u'_ih\n']
In [3]: %hist -r
1: 44
2: _ih
3: %hist -r
In [4]: _ih
Out[4]: ['\n', u'44\n', u'_ih\n', u'_ip.magic("hist -r")\n', u'_ih\n']
In [5]: %hist -r
1: 44
2: _ih
3: %hist -r
4: _ih
5: %hist -r
In [6]: _ih
Out[6]:
['\n',
u'4',
u'4',
u'\n',
u'_',
u'i',
u'h',
u'\n',
u'_',
u'i',
u'p',
u'.',
u'm',
u'a',
u'g',
u'i',
u'c',
u'(',
u'"',
u'h',
etc...
}}}
It appears that once there are magics in the history, a call to %hist -r
overwrites the _ih object, turning it from a list of lines into a list of
characters.
--
Ticket URL: <http://ipython.scipy.org/ipython/ipython/ticket/188>
IPython <http://ipython.scipy.org>
The IPython interactive Python system
More information about the Ipython-tickets
mailing list