使用嵌套的ipywidgets交互函数时无法抑制要显示的函数名

can't suppress the function name to be displayed when using nested ipywidgets interact functions

使用嵌套小部件交互功能,如下面最小案例所示,但无法抑制要显示的功能名称。分号不起作用。

import ipywidgets as widgets

def dummy_func(a, b):
    return a + b

def interactive_dummy_func(b=4, a=2):
    return widgets.interact(dummy_func, 
                             a = a,
                             b = b);

@widgets.interact
def wrapped_interactive_dummy_func(condition=True):
    if condition == True:
        return interactive_dummy_func(a=3, b=5);
    else:
        return "Something else"

输出总是显示函数名称,无法抑制它

自动显示交互包装函数,因此无需 return 上一个函数中的任何内容(即函数名称的来源)

import ipywidgets as widgets

def dummy_func(a, b):
    return a + b

def interactive_dummy_func(b=4, a=2):
    return widgets.interact(dummy_func, 
                             a = a,
                             b = b)

@widgets.interact
def wrapped_interactive_dummy_func(condition=True):
    if condition == True:
        interactive_dummy_func(a=3, b=5)
    else:
        return "Something else"