[IPython-user] Need post_runcode_hook

Gael Varoquaux gael.varoquaux@normalesup....
Mon Sep 29 13:16:37 CDT 2008


On Mon, Sep 29, 2008 at 11:14:46AM -0700, Brian Granger wrote:
> This is worth discussing further.

> We should probably have hooks for pre, during and post execution.  I
> don't have much time right now, but some quick thoughts:

> * The hook that gets run for the actual code execution, should get
> passed the string of code that was entered (not the complied code).
> The reason for this is that it opens the door for IPython to
> understand other languages.  For instance, you could have a %fortran
> magic that uses the hook - then a user could simply type fortran code
> in and we (someone?) could use the code along with f2py to
> automatically wrap the fortran code.  Sage uses this type of thing
> extensively.

> * Currently, the %autopx magic hacks the runcode method to do
> something like this.  This magic could use these hooks.  One thing
> that it important though is that the hooks are designed in a way that
> allows the default to be quickly reset.

> Other thoughts?

In the frontend code we have things similar (not abstracted or nicely
coded, I fear) used to turn on and off capturing of output, exception,
and co.

Gaël


More information about the IPython-user mailing list