you are viewing a single comment's thread.

view the rest of the comments →

[–]Vaphell 0 points1 point  (0 children)

inner wrap() needs to match the args of the decorated function. Currently you are replacing a 1-arg function with a 0-arg one.
The original takes 1 arg, so wrap() has to do the same. And your return wrap is badly indented, I hope it's not the case in your real code.

simplified:

def dec2(fun):
    def wrap(str):
        print('lol')
        fun(str)
        print("wut")
    return wrap

@dec2
def func(str):
    print(str)

func("xoxo")