title: How can I pass only some of my values as arguments to a function, according to what the function needs?
body: <p>I wondering if it is possible to pass functions with different number of arguments to another function in Python. </p>
  
  <p>For example</p>
  
  <pre><code>def aux_1(arg1,arg2):
      if arg1 &gt; arg2: return 1
      else: return 0
  def aux_2(arg1,arg2,arg3):
      return arg1 + arg2 * arg3
  def Main_fn(function_to_use,arg1, arg2, arg3):
      return function_to_use(?)
  &gt;&gt;&gt;Main_fn(aux_1,1,2,1) #Example cases
  &gt;&gt;&gt;Main_fn(aux_2,1,2,1)
  </code></pre>
  
  <p>So this is my doubt, if I pass function aux_1 how could I ensure it uses only arg1 and arg2. Similarly, if I use aux_2 all the three arguments need to used.</p>
  
  <p><strong><em>I know</em> it is possible to use a set of if conditions in the Main_fn, using inspect.getargspec()/varargs</strong> to appropriately pass on the arguments. However, such a logic would require modifications to the Main_fn each time I make a new <strong>aux</strong> function to handle its arguments, which is not practical in a large development scenario. </p>
  
  <p>Hence, I'm looking for a way around this.</p>
  
  <p>Please feel free to question me, if in need of further clarifications.</p>