Created
May 23, 2017 13:10
-
-
Save ericzhong/f3ed221c21a05dd48e6746ecdde1a1a0 to your computer and use it in GitHub Desktop.
装饰器
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 log(func): | |
def foo(): | |
print('call %s' % func.__name__) | |
return func() | |
return foo | |
@log | |
def test(): | |
pass | |
test() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment