Skip to content

Instantly share code, notes, and snippets.

@kunpengku
Created August 14, 2017 06:55
Show Gist options
  • Save kunpengku/c0fd3c906b8b80254ccfc3a64a1d979c to your computer and use it in GitHub Desktop.
Save kunpengku/c0fd3c906b8b80254ccfc3a64a1d979c to your computer and use it in GitHub Desktop.
注册装饰器
_functions = {}
def register(f):
global _functions
_functions[f.__name__] = f
return f
@register
def foo():
return 'bar'
print _functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment