[IPython-dev] quick way to reset & run a program

Fernando Perez fperez.net@gmail....
Thu Feb 26 01:19:24 CST 2009


On Wed, Feb 25, 2009 at 5:27 PM, Allen Fowler <allen.fowler@yahoo.com> wrote:
> Hello,
>
> Is there a quick/easy way to reset the interpreter's state, and then run an external file?
>
> Basically I'm looking for a quicker way to execute: "%reset, confirm [yes], %run". (Optional clearing the cached output history. )

Not out of the box, but writing a little magic to do this is and
installing it in your home dir is pretty easy.  Unfortunatley you
can't quite just make your magic do 'reset -y, run' because %reset
asks unconditionally.  But %reset is small enough (see magic_reset in
Magic.py) that you can simply copy its contents into your own personal
%rrun and then have that call %run.  Let us know if you have any
problems with this and need further help.

Cheers,

f


More information about the IPython-dev mailing list