[SciPy-User] Pylab - standard packages

Thomas Kluyver takowl@gmail....
Sat Sep 22 11:41:48 CDT 2012


Hi Lou,

On 22 September 2012 16:22, Lou Pecora <lou_boog2000@yahoo.com> wrote:
> I bring this up because as cool as IPython is, I have never found a good way to use it for my style of research/development.  I often just run from scripts instead since the code has to be continually re-interpreted (I'm assuming Python here) and IPython seems to put up road blocks to using software while modifying it.  At least I haven't found a way to do it.  If you could do that seamlessly, that would be a big advance!

Well, that's definitely the sort of use case we're thinking about - a
mixture of developing code and doing research with it. A few ideas
about how you can use code and modify it, depending on the size of the
code:

- Small functions/classes can live in a notebook cell: modify it and
rerun the cell to redefine it.
- For scripts, you can use the %run magic function. It works a lot
like running 'python script.py' at a command line, but when something
goes wrong, you get a much better traceback, and a %debug magic
command will drop you into the debugger. There's also a %edit magic
function to edit a file.
- You can import code and use the autoreload extension [1] to reload
the modules every time you change them.
- If you have a lot of modules importing from one another, there's a
deepreload function [2] that will reload all of them in one go.

[1] http://ipython.org/ipython-doc/stable/config/extensions/autoreload.html
[2] http://ipython.org/ipython-doc/stable/interactive/reference.html?highlight=deepreload#recursive-reload

I hope that gives you some ideas.

Best wishes,
Thomas


More information about the SciPy-User mailing list