[IPython-user] Need post_runcode_hook

Barry Wark barrywark@gmail....
Mon Sep 29 16:27:50 CDT 2008

On Mon, Sep 29, 2008 at 1:23 PM, Brian Granger <ellisonbg.net@gmail.com> wrote:
>> Note that by the time it reaches runcode, it has been mangled by
>> prefilters. Running non-python code can be done in prefilters (by
>> translating the code to something like
>> fortranrun("code-to-execute")
> You are right that in many cases, this could be handled by
> prefilter-level things.
> Except it doesn't work for some cases.  The only case where this it
> does work is when code-to-run, can be grabbed from a single IPython
> input statement.  In many cases, you want to build/type code-to-run
> out of _many_ IPython input statements (maybe one IPython input for
> each _line_ of the fortran code).  This is how %autopx works.  Once
> you enable %autopx, you simply type normal Python code (with no extra
> syntax), but that code is run in parallel because of how %autopx hacks
> ipython.  This continues until you toggle %autopx.  Does this make
> sense?  Fernando, do you know how sage does these types of things?  Is
> it a prefilter level thing?
> The prefilter only works at the level of a single input (which can be
> a line or blocks, but not multiple blocks).

Somewhat off topic, but having these hooks (along with support for
non-dict namespaces that we already have) could let the user undo
changes made to the namespace, for example after entering the "wrong"
code during a long interactive session.... might be useful. The hooks
could be used to implement something like transactions for the
namespace. Just a thought.

back to work...


More information about the IPython-user mailing list