What is Decorators in Python?




What is Decorators in Python ?
 Decorator is a function that takes another function and extends the behavior of the latter         
 function without explicitly modifying it.

 Functions can be defined inside another function and can also be passed as argument to another   function.


Now Lets see an Example of  Decorator

def  first (test):
    def  second ( ):
        test()
        print("hi")
       
    return second
def  third ( ):
    print("hello")
   
x= first( third )
x()














Comments