Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23160

Calling decorator returns output of original function

$
0
0

i need to know why the output of this code is sayhello() only???

def myDecorator(func):  # Decorator    def nestedfunc():  # Any Name Its Just For Decoration        print("Before")  # Message From Decorator        func()  # Execute Function        print("After")  # Message From Decorator    return nestedfunc  # Return All Datadef sayHello():    print("Hello from sayHello function")myDecorator(sayHello())

Viewing all articles
Browse latest Browse all 23160

Trending Articles