如何将函数名称传递给函数然后调用它? 是否可以在不使用
getattribute的情况下执行此操作?如何将类名传递给函数,然后实例化该类? 我知道我可以将类的实例直接传递给函数,但重要的是类在调用函数之后被实例化。
请您参考如下方法:
def outer(f): # any name: function, class, any callable
return f() # class will be instantiated within the scope of the function
