我正在尝试在 python 中实现强类型遗传编程。
有类似这些样本的东西吗?
def funcA(a,b):
return a + b
return_type(funcA)
output: <class 'Integer'>
和
def funcA(a,b):
return a + b
parameter_type(funcA)
output: [<class 'Integer'>,<class 'Integer'>]
更新:
我正在尝试生成python的表达式并避免无法像这样评估某些内容:
funcA(20, funcA(True, "text"))