是否可以(如果可以,如何)在定义后更改函数的参数?
例子:
from inspect import signature
def f(a, b, c):
print(a + b + c)
for i in signature(f).parameters:
print(i)
changeparameters(f, "d", "e")
print()
for i in signature(f).parameters:
print(i)
会输出:
a
b
c
d
e