Do python decorator function support arguments a how is the implementation
def decorator(fn, decorArg):
print "I'm decorating!"
print decorArg
return fn
class MyClass(object):
def __init__(self):
self.list = []
@decorator
def my_function(self, funcArg = None):
print "Hi"
print funcArg
on run I got this error
TypeError: decorator() takes exactly 2 arguments (1 given)
I've tried @decorator(arg) or @ decorator arg . it did not work as well. So far I wonder if this is possible