Python 101 : Decorators with parameters - passing arguments to a decorator -


 

We could use decorators with parameters for example to control the flow of the execution of a decorator as we can see below:



As we can see above, we could use a "boolean" parameter in the decorator to "decorate" function depending on the value of the "boolean" variable.

Comments

Leave as a comment:

Archive