In ipython, we can use
_ih[32:39]
To show history lines between 32 and 39. How can I directly execute these history lines?
You can create a named macro from the lines and execute them:
%macro foo 32-38 foo
This is useful if you want to execute the same set of lines more than once. Also the lines do not need to be sequential or in order:
%macro bar 38 37 32-36 42