No, not in the way you think it is. What you can do instead is something like this: def do_something(i): ... do_something ... def loop(n, func): for i in range(n): func(i) loop(10, do_something)