Skip to content

Instantly share code, notes, and snippets.

@AashishNandakumar
Created October 9, 2024 11:56
Show Gist options
  • Save AashishNandakumar/2b85aa20053962cf08c79ecd42b2448e to your computer and use it in GitHub Desktop.
Save AashishNandakumar/2b85aa20053962cf08c79ecd42b2448e to your computer and use it in GitHub Desktop.
Python3 - Decorators and Current Time functions
def uppercase_converter(func):
def wrapper():
temp_res = func()
return temp_res.upper()
return wrapper
# @uppercase_converter
def greet():
return 'hello world'
# same as
print(uppercase_converter(greet)())
# import time
# print(time.time()) # current time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment