[IPython-User] %edit in qtconsole vs ipython

Thomas Kluyver takowl@gmail....
Tue Aug 2 13:34:03 CDT 2011

On 2 August 2011 19:18, reckoner <reckoner@gmail.com> wrote:

> My preference is for the run on exit option, however, I would be very
> helpful if the subsequently edited file was injected into the history as
> %loadpy does. For example, doing something like:
>    In[321]: %edit _i3
> allows you to edit the previous input, but this does not save the
> changes in the history, which is a major limitation. My vote is to
> allow,  on editor exit, for an automatic %loadpy, or at least a
> configuration option that allows this.

You can use %loadpy and %recall (in your example, "%recall 3" to get input
line 3), and edit inside the shell. These work the same in the terminal and
the QtConsole, but the terminal is a pain for editing multiple lines.

It would require a major change to the code to store the edited code as the
translation of "%edit x", unfortunately. At present, history is stored
before editing begins, before it even looks up the code to edit. And the
idea of input translation is that it's a relatively lightweight process with
little room for errors to occur.

We could put the code at the next prompt after editing, so you'd have to
press enter to run it, and your history would look like this:

3: print "Hello wolrd"
4: %edit _i3
5: print "Hello world"

But I think that would just be annoying, both for the people who do want it
to run automatically, and for the people who don't.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20110802/342b4cc9/attachment.html 

More information about the IPython-User mailing list