Created
August 14, 2017 03:19
-
-
Save BolajiOlajide/bd2d10cdf4311522260e346aca80d241 to your computer and use it in GitHub Desktop.
Simple 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
def print_method_type(f): | |
def decorated(*args, **kwargs): | |
print f, type(f) | |
return f(*args, **kwargs) | |
return decorated | |
@print_method_type | |
def add(x,y): | |
return x + y | |
add(2,3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment