Re: Getting the Input History

Thomas Kluyver <[email protected]> Wed, 18 Jan 2017 15:23:54 +0000
Newsgroups gmane.comp.python.ipython.devel
Message-ID <CAOvn4qiJ9YCAKPS9OJddPSaNGhjbr6hoxcgBw5g4tdm+TAf4sA@mail.gmail.com>
On 18 January 2017 at 14:09, Carl Smith <[email protected]> wrote:

> Is there a nice way to get the input history as a list?
>

Yep, it's accessible as _ih inside IPython. For a magic command or
something, you can get it as: shell.history_manager.input_hist_raw


> I'd like to create a magic, named something like *squash*, that basically
> combines the previous *n* inputs into a single string that can then be
> edited as one input. For example, entering these three lines...
>

The %recall magic can already do something similar with a range of input
numbers, e.g. %recall 1-3 5 7 should give you a new prompt with inputs 1-3,
5 and 7.

Thomas

_______________________________________________
IPython-dev mailing list
[email protected]
https://mail.scipy.org/mailman/listinfo/ipython-dev