> Where do we draw the line? How much of the behaviour of the
> function do we want to move into the header?

Well obviously we don't draw the line until we've fallen down the
slippery slope and the entire body of the function is part of the
header!

Sure, what's the problem? :-)

def hof(*, op=lambda F: lambda x: F(x), fn=lambda x: x**2, val=None):
    # Default is squaring, do what you want.
    return op(fn)(val)

--
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.