Decorators with arguments [duplicate]
问题 This question already has answers here : Decorators with parameters? (10 answers) Closed 4 years ago . Code as follows def my_dec(func): def wrap(w): t = func(w) return t * 4 return wrap @my_dec def testing(n): return n new = testing(3) print(new) # This prints 12 This example is working fine, but now I'm trying to add the following to the decorator @my_dec(100) , I need to multiply the given number by 100. When I try this @my_dec(100) def testing(n): return n I get the following error: