PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Created by Ketan Lalcheta
#what if i need both functions with and without decorator
def decorator(func):
def wrapper(*args, **kwargs):
print("Hi from decorator")
print("before func call")
return func(*args, **kwargs)
print("after func call")
return wrapper
def myfunc():
print("Hi from function")
a = myfunc
a()
print('-----_-\n')
b = decorator(myfunc)
b()
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run