Python: Passing function with arguments to a function

Viewed 1122

I have two functions:

  1. library function which I cannot change say lib_func( func, param1)
    i.e. lib_func takes a function func and some other parameter param1 as arguments.

  2. user defined function user_func.

For example:

x = 0
y = 0
def user_func():
    global x
    global y 
    return sqrt(x*y)

Now the problem is I want to pass x to user_func as argument not as globals while passing user_func to lib_func.

4 Answers
Related