How to wrap builtins.input in Jupyter Notebook?

16 views
Skip to first unread message

Jakób Makowczyk

unread,
Dec 28, 2020, 9:19:05 AM12/28/20
to Project Jupyter

I wonder how Jupyter Notebook works with builtins? Suppose, I want to replace an internal function, for example input. But this only works within the cell. Although directly in IPython everything is okey (not without problems, but in general outside the cell the trick works). What's wrong with Jupyter?

The code for the experiment:

import builtins

builtins.input = lambda prompt, *, _input=input: print('Hello world!') or _input(prompt)

builtins_jupyter_notebook.png
builtins_ipython.png
Reply all
Reply to author
Forward
0 new messages