Skip to content

Instantly share code, notes, and snippets.

@shivankgtm
Last active April 14, 2020 07:34
Show Gist options
  • Save shivankgtm/41f48384c7380d802729ba101c10ab82 to your computer and use it in GitHub Desktop.
Save shivankgtm/41f48384c7380d802729ba101c10ab82 to your computer and use it in GitHub Desktop.
def decorator_for_print(function):
def print_args(*args):
print('GIVEN arguments are ', args)
return function(args)
return print_args
@decorator_for_print
def func(alist):
return alist
print(some_function([1,2,3,4,5,6])) # call the function.
# Output:
# GIVEN arguments are ([1, 2, 3, 4, 5, 6],)
# ([1, 2, 3, 4, 5, 6],)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment