Skip to content

Instantly share code, notes, and snippets.

@JackInTaiwan
Last active November 3, 2018 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JackInTaiwan/15ebaa7abe6312ae12215bf56b6f2d5f to your computer and use it in GitHub Desktop.
Save JackInTaiwan/15ebaa7abe6312ae12215bf56b6f2d5f to your computer and use it in GitHub Desktop.
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