Now how much nicer would it be if even more things were functions, rather than special syntax like here? This can be done with an `apply`.
f1 = partial(f, 1, 2)
f2 = partial(f1, 3, 4)
f2(5, 6) # equivalent to f(1, 2, 3, 4, 5, 6)
It also supports kwargs. def apply(f, a):
return f(*a) apply(l, print)
is the same as for el in l:
print(el)
which is a number of print statements, rather than 1 print statement with a number of arguments.