Предположим, я запускаю следующий код в интерактивной оболочке IPython:
Код: Выделить всё
def pre_run_cell(info):
raise RuntimeError("please don't run")
get_ipython().events.register("pre_run_cell", pre_run_cell)
Код: Выделить всё
pre_run_cell()
However, even though the
Код: Выделить всё
pre_run_cell()
Код: Выделить всё
In [3]: 1
Error in callback (for pre_run_cell), with arguments args (,),kwargs {}:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
Cell In[1], line 2, in pre_run_cell(info)
1 def pre_run_cell(info):
----> 2 raise RuntimeError("please don't run")
RuntimeError: please don't run
Out[3]: 1
Код: Выделить всё
pre_run_cell
I don't see anything in the documentation of
Код: Выделить всё
pre_run_cell
Источник: https://stackoverflow.com/questions/779 ... fied-in-ip