2 ms·
You mean something like: class FancyDecorator(): __init__(self, *args): self.args = args __call__(self, fn): return decora
by UncleEntity 9y ago
You mean something like:
class FancyDecorator():
__init__(self, *args):
self.args = args
__call__(self, fn):
return decorate_fn_with_args(fn, self.args)
dec = FancyDecorator(42)
@dec
def foo():
pass
@FancyDecorator(41)
def bar()
pass
Might have it wrong since I haven't messed with decorators in a while and they aren't exactly what one would call simple.
--edit--
code formatting is all wonky so...