Last active
November 3, 2018 10:22
-
-
Save JackInTaiwan/15ebaa7abe6312ae12215bf56b6f2d5f 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
def print_func_name(func): | |
def warp_1(): | |
print("Now use function '{}'".format(func.__name__)) | |
func() | |
return warp_1 | |
def print_time(func): | |
import time | |
def warp_2(): | |
print("Now the Unix time is {}".format(int(time.time()))) | |
func() | |
return warp_2 | |
@print_func_name | |
@print_time | |
def dog_bark(): | |
print("Bark !!!") | |
if __name__ == "__main__": | |
dog_bark() | |
# > Now use function 'warp_2' | |
# > Now the Unix time is 1541239747 | |
# > Bark !!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment