title: Is there a way in python to check the required arguments of a function or method before invoking it?
body: <p>This question is merely out of curiosity. Let's say I have the two functions below.</p>
  <pre><code>def func_1(a, b):
      return a + b
  
  
  def func_2(a, b, c):
      return a + b + c
  </code></pre>
  <p>Then I get three ints from the user. Is there a way to do something like this?</p>
  <pre><code>if &lt;func_1 accepts a, b, and c&gt;:
      print(func_1(a, b, c)
  else:
      print(func_2(a, b, c)
  </code></pre>
  <p>I know about *args, **kwargs, and try/except clause, and I know there are other ways to get around this. The reason this came to my mind is that some packages like huggingface evaluate currently have a bug where they can't run some metrics together because if they pass the content of **kwargs to the metrics' functions one of them will raise unexpected keyword errors while others are expecting the arguments or don't care about them. Furthermore, the number of metrics are just too many to implement except clauses not to mention how expensive traceback generation is. So, I thought if there was a way to loop and add arguments when needed without trying/except the problem will be solved. I played around with <code>partial</code> from <code>functools</code> but it does not evaluate the function before it is invoked. Hence, the question. Does anyone know of a way?</p>