Passing and Calling (Built-in) Functions : parameter « Function « Python Tutorial






def convert(func, seq):
    return [func(eachNum) for eachNum in seq]

myseq = (123, 45.67, -6.2e8, 999999999L)
print convert(int, myseq)
print convert(long, myseq)
print convert(float, myseq)








10.2.parameter
10.2.1.The semantics of argument passing
10.2.2.Pass functions to other functions as arguments
10.2.3.Passing Functions as parameter
10.2.4.Passing and Calling (Built-in) Functions
10.2.5.Positional Arguments
10.2.6.Passing lists and individual list elements to functions.
10.2.7.Simulating Output Parameters
10.2.8.Unpacking arguments