Given the Python function:
def a_method(arg1, arg2):
pass
How can I extract the number and names of the arguments. I.e., given that I have a reference to func
, I want the func.[something]
to return ("arg1", "arg2")
.
The usage scenario for this is that I have a decorator, and I wish to use the method arguments in the same order that they appear for the actual function as a key. I.e., how would the decorator look that printed "a,b"
when I call a_method("a", "b")
?