假设我有一些代码,如下所示:
def myfunc(anotherfunc, extraArgs):
# somehow call `anotherfunc` here, passing it the `extraArgs`
pass
我想将另一个现有的函数作为anotherfunc
参数传递,并将参数列表或元组作为extraArgs
,并让myfunc
使用这些参数调用传入的函数。
这种做法可行吗?我该如何实现?