Created
May 21, 2020 01:51
-
-
Save seozed/908eab2c9395e3f2e9cbd02323bb2ef9 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
from functools import wraps | |
def timethis(func): | |
''' | |
Create a decorator . | |
''' | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
result = func(*args, **kwargs) | |
return result | |
return wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment