Created
March 24, 2020 18:25
-
-
Save StephenFordham/564410ebd65aab2014c6937bce47dd62 to your computer and use it in GitHub Desktop.
default_decorator_arg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👏