Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

interact: different behavior concerning **kwargs in SageCell an Jupyter notebook

I'm trying to use the output of one interact as the input for number of control elements in a second interact. The following examle code works in Sage Jupyter notebook but fails in SageCell (Unfortunately I can't post a link to SageCell due to my low karma).

I don't understand why it fails and how I can make the code run in SageCell.

def f(s=slider([1,2], default=1)):
    kwargs = { f"C_{i}": checkbox() for i in range(s)}
    def f2(**kwargs):
        for key, value in kwargs.items():
            print(f"{key} is {value}")