-
-
Save jasisz/485589e842bdfa7f4116c2f3591d05a4 to your computer and use it in GitHub Desktop.
This file contains 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
functions = [] | |
def fancy_decorator(name): | |
def wrapper(func): | |
func.name = name | |
print('Registering func with name {}'.format(name)) | |
functions.append(func) | |
return func | |
return wrapper | |
def single_handler(): | |
pass | |
for n in ['one', 'two', 'three']: | |
fancy_decorator(n)(single_handler) | |
for f in functions: | |
print(f.name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment