iPython: How to reload & run?
Hello, New iPython user here.... Typing %run only reloads the actually file... any of my modules are not reloaded even if I've chenged them. Is there short-cut command to %run a file and forcefully reload any modules that its uses? Thank you ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page. http://www.yahoo.com/r/hs
On Sun, Mar 23, 2008 at 5:29 PM, Allen Fowler <allen.fowler@yahoo.com> wrote:
Hello,
New iPython user here....
Typing %run only reloads the actually file... any of my modules are not reloaded even if I've chenged them.
Is there short-cut command to %run a file and forcefully reload any modules that its uses?
No, unfortunately no. I typically just put a few judiciously chosen reload(foo) reload(bar) atop the script itself. You should keep in mind that generically, reloading is tricky business: it's order-dependent, and what to do with already in-memory objects when their supporting modules change isn't clear. Python still has a way to go before we catch the fabled lisp machines from the 70's in terms of interactive modifications of live code, I'm afraid. Cheers, f
On 23/03/2008, Allen Fowler <allen.fowler@yahoo.com> wrote:
Hello,
New iPython user here....
Typing %run only reloads the actually file... any of my modules are not reloaded even if I've chenged them.
Is there short-cut command to %run a file and forcefully reload any modules that its uses?
Not exactly. But ipython provides dreload() to make reloading recursive. There are also issues with existing objects keeping the same code they were created with; see http://mail.python.org/pipermail/python-list/2004-June/264778.html for a partial solution. Anne
On Sun, Mar 23, 2008 at 5:53 PM, Anne Archibald
Not exactly. But ipython provides dreload() to make reloading recursive. There are also issues with existing objects keeping the same code they were created with; see http://mail.python.org/pipermail/python-list/2004-June/264778.html for a partial solution.
I didn't want to mention dreload :) Partly because it's not really 100% robust, but lots of people seem very happy with it, so definitely keep it in mind. Cheers, f
participants (3)
-
Allen Fowler
-
Anne Archibald
-
Fernando Perez