@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic (No. 2652 / 12833)
There is an example of passing function as an argument.
I've tried.
http://ideone.com/KHr1xa
def myfunc(fnc, arg1, arg2):
fnc(arg1, arg2)
def myprint(arg1, arg2):
print('%s,%s' % (arg1, arg2))
myfunc(myprint, 3.1415, 2.718)
result
Success time: 0 memory: 23304 signal:0
3.1415,2.718
Does the standard document seem to be related to this? Interpretation of arguments and construction of values
@ shiracamus's Comment taught me how to execute a function using map ()
.
Also, in this Comment, I learned how to call the function name as a key from the local variable dictionary and execute it.
Thank you for the information.
Recommended Posts