How to override ipython displayhook?
问题 I have defined my own displayhook that inherits from IPython.core.displayhook.DisplayHook. I was unable to find any resources online as for the proper way of overriding the displayhook for an IPython shell. Currently, I am doing the following in ~/.ipython/profile_default/startup/imports.py: ipyShell = IPython.get_ipython() ipyShell.displayhook = MyDisplayHook(shell=ipyShell) ipyShell.displayhook_class = MyDisplayHook sys.displayhook = ipyShell.displayhook Which does not work, as after the