""" example of a decorator """ def debug_it(f): def f_debug(x): value = f(x) print(f"debug: {f.__name__}({x}) = {value})") return value return f_debug @debug_it def twice_plus_one(y): return 2*y+1 def main(): print(sum([twice_plus_one(i) for i in range(10)])) main()