I have written following code for you. In the following code I have passed one function with parameters to another function. It is very easy to understand. In the following code I have use Param and lambda keyword to do this. First I have cretae one function known as bigs1(func) and after that I have create another function like bigs2(func) for passing this function to bigs1(func).
Code:
def lite(x,y,z):
return "%r,%r,%r" % (x,y,z)
def bigs1(func): # func = callable()
print func()
def bigs2(func): # func = callable with ones argument
print func("anything you want")
def main():
params1 = 1
params2 = 2
params3 = 3
big2(lambda xs: lite(params1, params2, params3))
def lites_withs_paramss():
return lite(params1,params2,params3)
big(lites_withs_paramss)
main()
Bookmarks