Skip to content

Instantly share code, notes, and snippets.

@eriky
Created November 17, 2020 20:12
Show Gist options
  • Save eriky/902e18036e55c0eb8d039188b7292588 to your computer and use it in GitHub Desktop.
Save eriky/902e18036e55c0eb8d039188b7292588 to your computer and use it in GitHub Desktop.
def print_argument(func):
def wrapper(the_number):
print("Argument for", func.__name__, "is", the_number)
return func(the_number)
return wrapper
@print_argument
def add_one(x):
return x + 1
print(add_one(1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment