title: Python: Passing function with arguments to a function
body: <p>I have two functions:</p>
  
  <ol>
  <li><p>library function which I cannot change say <code>lib_func( func, param1)</code><br>
  i.e. <code>lib_func</code> takes a function <code>func</code> and some other parameter <code>param1</code> as arguments.</p></li>
  <li><p>user defined function <code>user_func</code>.  </p></li>
  </ol>
  
  <p>For example:</p>
  
  <pre><code>x = 0
  y = 0
  def user_func():
      global x
      global y 
      return sqrt(x*y)
  </code></pre>
  
  <p>Now the problem is I want to pass x to <code>user_func</code> as argument not as globals while passing <code>user_func</code> to <code>lib_func</code>.</p>