print(" NO AGRUMENTS ".center(30, "#")) def this_adds_decoration(function_to_decorate): def this_creates_decoration(): print("Before") function_to_decorate() print("After") # Return the created decoration to add it to a function return this_creates_decoration @this_adds_decoration def normal_function(): print("Normal output") normal_function() # Before # Normal output # After print(" WTH AGRUMENTS ".center(30, "#")) def this_adds_decoration_with_arguments(function_to_decorate): def this_creates_decoration(*args, **kwargs): print("Before") print("I know already that name is: {0}".format(args[0])) function_to_decorate(*args, **kwargs) print("After") # Return the created decoration to add it to a function return this_creates_decoration @this_adds_decoration_with_arguments def greeting(name): print("Hello {0}".format(name)) greeting("You") # Before # I know already that name is: You # Hello You # After