Last active
December 14, 2018 10:10
-
-
Save foowaa/17f1f230b41f4dccf82984a6b94fa413 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
import functools | |
def log1(func): | |
@functools.warp(func) | |
def wrapper(*args, **kw): | |
print("call %s():", func.__name__) | |
return func(*args, **kw) | |
return wrapper | |
def log2(text): | |
def decorator(func): | |
@functools.warp(func) | |
def wrapper(*args, **kw): | |
print("%s %s()"%(text, func.__name__)) | |
return func(*args, **kw) | |
return wrapper | |
return decorator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment