5 May
2020
5 May
'20
9:38 a.m.
Here is a quick and dirty proof of concept: from inspect import stack, Signature def parameters(): caller = stack()[2][0].f_globals[stack()[1][3]] sig = Signature.from_callable(caller) vars = stack()[1][0].f_locals return sig.bind(**vars).arguments def func(spam, eggs): params = parameters() for name, value in params.items(): print(name, '=', value) Calling `func(2, 3)` prints: spam = 2 eggs = 3 -- Steven