Created
September 20, 2016 02:52
-
-
Save guoqiao/a7cc90cba0f24216d74edfc3458288c1 to your computer and use it in GitHub Desktop.
example for register decorator
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 register(f): | |
global _functions | |
_functions[f.__name__] = f | |
return f | |
@register | |
def foo(): | |
return 'bar' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment