[SciPy-user] Ipython "run"

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Jul 29 09:11:36 CDT 2005


>>>>> "Howey," == Howey, David A <d.howey at imperial.ac.uk> writes:

    Howey> Perhaps someone could share their experience using the
    Howey> magic command %run in Ipython? I'm just testing it out,
    Howey> and unfortunately it doesn't seem to do a full reload of
    Howey> all imported modules etc. IDLE's <F5>, on the other hand,
    Howey> does. This is annoying!  Any tips?  Dave

One man's annoyance, another man's feature.  When you are *using*
really big modules that can take tens of seconds to import, it's nice
not to have to pay the cost of the reload with each run.  When you are
*developing* modules that the script imports, it's a pain not to have
your code reloaded.  A good rule of thumb is to use run when you are
using a module, not when you are developing it.

You can achieve the desired behavior by doing
 
   In [7]: !python myscript.py

Fernando, would it be useful to have a -python or -force or -reload
option to run which produces the equivalent of the above.  If only for
didactic purposes, it would make it clearer in the docstring that a
reload is not taking place.  Perhaps the current run documentation is
a bit misleading, where it reads:

    This is similar to running at a system prompt:
      $ python file args


JDH



More information about the SciPy-user mailing list