[SciPy-user] python/scipy as matlab, using ipython
fperez.net at gmail.com
Fri Sep 15 14:42:12 CDT 2006
On 9/15/06, Lars Friedrich <lfriedri at imtek.de> wrote:
> Hello scipy users,
> for a short time now, I am using python, numpy and scipy as a
> replacement for matlab. My setup at the moment is the "scite"-editor and
> the "ipython"-shell. I am happy using the "run -i" command to access the
> current workspace with my scripts written with scite.
> There is one feature that I know from matlab that I miss a little. Maybe
> its not crucial but it would be nice to have:
> When I made a change to my script in scite, I have to
> *save it
> *change scope to ipython
> *recall the "run -i myScript.py" command
> *press <enter>
> In matlab it is possible to hit <F5> to get the same effect. How can I
> achieve this with scite/ipython? I think, I need a way to tell ipython
> "from extern" to execute the "run"-command. I would put this to my
> scite-config-file to connect it with, say, the <F5> button and would be
> fine. Is this possible?
Unfortunately not currently in an automatic way. Here are a few
comments that may help to some degree:
* keep in mind that ipython uses a partial-matching search on your
history, so if you type 'r', up-arrow, it will probably find the 'run'
command quickly without having to up-arrow too many times. This can
save some time (that's how I work: C-s, alt-tab, r-up, <enter>).
* you can save a macro:
macro m <line number where you last ran your script>
and then invoke it again by just typing 'm' (or whatever you call it).
You can save your macros across sessions by typing
Macros are a little-used but /extremely/ useful feature of ipython.
* (X)Emacs can sort of do what you want, and it can probably be
extended to do exactly what you want. If you configure ipython/emacs
to work together as explained in
running your script is one keystroke away. Note that this does NOT do
'run -i', but rather a more pedestrian execfile. But it does support
ipdb source tracking, which can be extremely useful. And I'm sure a
tiny bit of hacking in the ipython.el file could provide options to
call run/run -i instead of just execfile().
* We could probably implement something like this using a named pipe
or a socket, but I've really stopped touching the trunk codebase as
the chainsaw branch is really far better suited to do this.
I created this ticket so we don't forget:
Note that it /can/ be done in the trunk, but I don't have the bandwith
to work there right now. If you cook up a patch, by all means send it
More information about the SciPy-user