-
Notifications
You must be signed in to change notification settings - Fork 0
python
supadhyaya edited this page Jul 24, 2023
·
7 revisions
decorators in python takes a function as a parameter, does something before & after & then return the grand function. Following is an example
def decorator(func):
def wrapper():
print("do something before")
func()
print("do something after")
return wrapper
# any function that undergoes a wrapper must use annotation during function definitio
@decorator
def hello:
print("Hello, I am the function")