Answer the question
In order to leave comments, you need to log in
How does the wrapper even get the arguments of the wrapped function?
I intuitively thought that we send a function with variables inside to the decorator, and referring to the wrapper , we just run it. Why does it take arguments from func1 if they are kind of "foreign" and still part of the call to func1 ? How to fit the work of the wrapper in your head?
def dec(func1):
def wrapper(*arg):
func1(*arg)
return wrapper
@dec
def func1(a,b,c):
pass
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question