Mar-19-2018, 05:48 PM
(Mar-19-2018, 05:31 PM)mp3909 Wrote: I now want to decorate this function so that the first argument is always multiplied by 4 and then added to the second argument.From the way you describe it, your decorator will not care what the function it's decorating does. Am I correct in saying what you actually want is a decorator which multiplies the first argument by a value provided to the decorator, before calling the decorated function?
I believe that in either case, my example should be fairly adaptable. Feel free to give it a try, and we can work from there.