I'm trying to decorate class method using class-decorator. For example
class MyDecorator(object):
def __init__(self,param1):
self.param1 = param1
# do some action with param1
def __call__(self,func):
def wrapped(*args,**kwargs):
print "in wrapper:"
func(*args,**kwargs)
return wrapped
and my some class:
class A:
@MyDecorator("Blablabla")
def func1(arg1,arg2,arg3):
print (arg1,arg2,arg3)
but when I do the next action:
a = A()
a.func(1,2,3)
I get the following error:
TypeError: func1() takes exactly 3 arguments (4 given)