In the below code i am trying to apply the decorator on a class method. And i see the error as TypeError: myfunc() takes exactly 2 arguments (1 given)
how to resolve this
class mydeco(object):
def __init__(self,f):
print "In init"
self.f = f
def __call__(self,args):
print args
print "===="
self.f(args)
class Test(object):
@mydeco
def myfunc(self,data):
print "===="
print "args is {0}".format(data)
t=Test()
t.myfunc("test123")
`TypeError: myfunc() takes exactly 2 arguments (1 given)`
In init
test123
====