Skip to content

Instantly share code, notes, and snippets.

@StephenFordham
Created March 24, 2020 18:25
Show Gist options
  • Save StephenFordham/564410ebd65aab2014c6937bce47dd62 to your computer and use it in GitHub Desktop.
Save StephenFordham/564410ebd65aab2014c6937bce47dd62 to your computer and use it in GitHub Desktop.
default_decorator_arg
def meta_decorator(arg):
def decorator_list(fnc):
def inner(list_of_tuples):
return [(fnc(val[0], val[1])) ** power for val in list_of_tuples]
return inner
if callable(arg):
power = 2
return decorator_list(arg)
else:
power = arg
return decorator_list
@meta_decorator
def add_together(a, b):
return a + b
# @meta_decorator(3)
# def add_together(a, b):
# return a + b
@bunyaminergen
Copy link

👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment