These are chat archives for ipython/ipython

8th
Jun 2015
Thomas A Caswell
@tacaswell
Jun 08 2015 02:05
Evening, is anyone around who can give advice on hijacking the standard python displayhook?
specifically, how to get a hook to trigger on statements as well as expressions
Zachary Jones
@bigzachattack
Jun 08 2015 03:28
@tacaswell Will this work?
from IPython.display import display
display(variable)
Thomas A Caswell
@tacaswell
Jun 08 2015 03:45
Sorry, was watching the wrong window
I am interested specifically in doing this with out IPython, but am hoping to leverage the repl knowledge of the IPyhon devs.
My specific problem is listed in detail at matplotlib/matplotlib#4504
In short, I have a function I need to call every time the user does anything at the repl (in this case effectively plt.draw_all() )
and if the user is in IPython, then we use the post_execute hook and everything is great
for users in a base python repl I know about sys.displayhook, but that gets only called whenever python evaluates an expression
which means that ln, = ax.plot() does not trigger the displayhook, which is very bad
Zachary Jones
@bigzachattack
Jun 08 2015 03:58
Ok, that make sense but is out of my scope of knowledge.
Min RK
@minrk
Jun 08 2015 06:11
You can do some manipulation of how code is compiled. We do some of this in run_ast_nodes or run_code, I believe.
Thomas A Caswell
@tacaswell
Jun 08 2015 15:51
@minrk That is more involved than I think we want to get for now. I think we have come up with a mpl side call back solution that get the same effect by leaning on the PyOS_inputhooks belonging to what ever gui framework we are sitting on top of
Kyle Kelley
@rgbkrk
Jun 08 2015 17:14
@/all What do people think about bringing in the R datasets to the demo image? jupyter/docker-demo-images#51
Matthias Bussonnier
@Carreau
Jun 08 2015 17:26
I think it's fine.
Min RK
@minrk
Jun 08 2015 17:31
Sure
Kyle Kelley
@rgbkrk
Jun 08 2015 19:56
Now to be more ridiculous, I found out that /r/thebutton has ended on Reddit
I included their data file in jupyter/docker-demo-images#52
How about that one @Carreau ?
;)