Skip to content
Advertisement

Syntax error when passing function with arguments to a function (python)

Learning decorators and I wanted to pass a function with arguments to a decorator function like shown below but I always get a syntax error. Please help!

JavaScript

Output:

JavaScript

Advertisement

Answer

Your syntax is incorrect. To define a correct decorator and wrapper function, see what follows:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement