I'm starting studying decorators and I already hit an obstacle. First here is my code.
def deco (f):
def coucou():
print("this is function{}".format(f))
return f()
return coucou
@deco
def salut():
print("salut")
def hi():
return salut()
I will try to explain my problem as well as I can with my bad English. If I understand it this is how things should happen: I execute my hi() function which returns salut() and because salut is modified by the decorator coucou will be executed and coucou returns ....... salut(), what i mean is that I expect an infinite loop but that doesn't happen and I don't understand why. Can anyone explain practically how decorators work?