[IPython-dev] [IPython-user] Hooking into the autocall displayer
fperez.net at gmail.com
Mon Sep 17 02:24:07 EDT 2007
On 9/16/07, Tom Denniston <tom.denniston at alum.dartmouth.org> wrote:
> When I use autocall in IPython one of the awesome things about it, is
> that it prints this green ------> with what it translated my code to.
> For example:
> In : map str, [1,2,3]
> ------> map(str, [1,2,3])
> Out: ['1', '2', '3']
> I wanted to hook into the function that does this printing because I
> have some custom translations taht i do using the result_display hook.
> I print -------> plus my translation but then I end up with a line
> that is:
> Out: -------> my translated result
> What i really want is
> ------> my translated result
> I could do it myself with some messy teminal escape sequence
> manipulation but it would be much cleaner if it is possible to call
> the function that IPython is using.
> Does anyone have any idea how to do this?
The routine that does this is auto_rewrite, in Prompts.py:
You could start testing out your idea with a quick and dirty
monkeypatch of that method. If it works, a proper API could be
More information about the IPython-dev