Fix Python – How do I pass extra arguments to a Python decorator?
I have a decorator like below.
def myDecorator(test_func):
return callSomeWrapper(test_func)
def callSomeWrapper(test_func):
return test_func
@myDecorator
def someFunc():
print ‘hello’
I want to enhance this decorator to accept another argument like below
def myDecorator(test_func,logIt):
if logIt:
print “Calling Function:….