Decorator that can take both init args and call args?
- by digitala
Is it possible to create a decorator which can be __init__'d with a set of arguments, then later have methods called with other arguments?
For instance:
from foo import MyDecorator
bar = MyDecorator(debug=True)
@bar.myfunc(a=100)
def spam():
pass
@bar.myotherfunc(x=False)
def eggs():
pass
If this is possible, can you provide a working example?