Even if this question was already answered and accepted, I’d like to show an idea which is IMHO quite elegant. The solution proposed by t.dubrownik shows a pattern which is always the same: you need the three-layered wrapper regardless of what the decorator does.
So I thought this is a job for a meta-decorator, that is a decorator for decorators. As a decorator is a function, it actually works as a regular decorator with arguments:
This can be applied to a regular decorator in order to add parameters. So for instance, say we have the decorator which doubles the result of a function:
With @parametrized we can build a generic @multiply decorator having a parameter
Conventionally the first parameter of a parametrized decorator is the function, while the remaining arguments will correspond to the parameter of the parametrized decorator.
An interesting usage example could be a type-safe assertive decorator: