Decorators In Python

 


# @dec1
# def function1():
# print("Subscribe Now !!")
#
#
# # func2 = function1
# # del function1
# # func2()

# By Harry
# def function1():
# print("Subscribe now")
#
# func2 = function1
# del function1
# func2()

# def funcret(num):
# if num==0:
# return print
# if num==1:
# return sum
# # print and sum are 2 functions in python
# a = funcret(1)
# print(a)

# def executor(func):
# func("this")
#
#
# executor(print)

# By Me

def dec1(func1):
def nowexec():
print("Now Excecuting")
func1()
print("Executed")

return nowexec()





@dec1
def who_is_harry():
print("Harry is a good boy")


# who_is_harry = dec1(who_is_harry)

who_is_harry



Comments

Popular posts from this blog

Practice Execise 3

Pickle Module