add prototype

This commit is contained in:
Daniel 2023-12-08 11:11:44 +01:00
parent 50eea28585
commit a860c01a89

View file

@ -0,0 +1,19 @@
import inspect
a = 2
b = 3
c = 4
def func(a: int, c: int) -> int:
return a + c
arg_names = inspect.getfullargspec(func).args
print(arg_names) # ['a', 'c']
arguments = {arg: globals()[arg] for arg in arg_names if arg in globals()}
print(arguments) # {'a': 2, 'c': 4}
result = func(**arguments)
print(result) # 6