However even plain old core Python helps in that students get a sense of functions as top-level citizens. I'm not saying Python is alone in providing this.
If the C language could be written:
function func(function f1, function f2):{ }
with type function both eaten and returned, then we could use C for this kind of thing also.
http://mathforum.org/kb/message.jspa?messageID=10168568 (more on this general topic)
The repl below (you may skip modal window) shows my latest slimmed down version of Compose, something I introduce to the O'Reilly course as well.
https://repl.it/HxMo/2Function type objects don't ordinarily multiply but what if we want to write h = f * g instead of h(x) = f(g(x)).
For one thing, why mention x at this point (the argument object) as we're simply defining a function, not calling it with an input right?
The Compose class is just the ticket, swallowing and wrapping a function with a __mul__ API. Now * is your compose operator. Or use __matmul__ for @ symbol.