You want to pass the function object hi
to your loop()
function, not the result of a call to hi()
(which is None
since hi()
doesn’t return anything).
So try this:
>>> loop(hi, 5) hi hi hi hi hi
Perhaps this will help you understand better:
>>> print hi() hi None >>> print hi <function hi at 0x0000000002422648>