私はfunc_listという関数のリストを持っています。Pythonで関数のリストを再帰的に呼び出しますか?
私はそれらを1つずつ実行したいので、func_list[index]
の実行結果をfunc_list[index + 1]
の引数として渡さなければなりません。
私はこのコードを思い付いた:
def func(arg, index):
while index < 10:
res = func_list[index](arg)
res = func(res, index+1)
return res
は、同じことを達成するための任意のより良い方法はありますか?
はい。 'for'ループを使います。 –