def lite(a,b,c): #... def big(func): # func = callable() #... #main big(lite(1,2,3))
how to do this?
in what way to pass function with parameters to another function?
All parameters (arguments) in the Python language are passed by reference. It means if you change what a parameter refers to within a function, the change also reflects back in the calling function.
There are two ways to pass parameters in C: Pass by Value, Pass by Reference.
Yes it is, just use the name of the method, as you have written. Methods and functions are objects in Python, just like anything else, and you can pass them around the way you do variables.
Luckily, you can write functions that take in more than one parameter by defining as many parameters as needed, for example: def function_name(data_1, data_2):
Why not do:
big(lite, (1, 2, 3))
?
Then you can do:
def big(func, args): func(*args)
import functools #main big(functools.partial(lite, 1,2,3))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With