title: How to pass additional parameters (besides arguments) to a function?
body: <p>I need to write a function (say <code>fun1</code>) that has one argument, because it will be used in other function (<code>fun2</code>). The latter requires a function with a single argument. However, I need to pass other parameters to function <code>fun1</code>. How can I do this in Python without using global variables? Or this is the only way? </p>
  
  <p>Addition:  If it is important, <code>fun2</code> is some optimization function from <code>scipy.optimize</code>. Below is an example of passing additional parameter <code>c</code> to function <code>fun1</code> using <code>global</code>. In the first call, function <code>fun2</code> takes <code>fun1</code> as <code>x+1</code>, but in the second call, <code>fun1</code> is <code>x+2</code>. I would like to make similar, but without using <code>global</code>. Hopefully, the example clarifies the question. (The example is changed).</p>
  
  <pre><code>def fun1(x) :
     global c
     return  x + c
  
  def fun2(f1, x) :
     return  f1(x)
  
  # main program
  global c
  x0= 1  
  c= 1;   y= fun2(fun1, x0);  print(y)    # gives 2
  c= 2;   y= fun2(fun1, x0);  print(y)    # gives 3
  </code></pre>