def decorator func def wrapper klass args kwargs print klass __class__

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
>>> def decorator(func):
... def wrapper(klass, *args, **kwargs):
... print klass.__class__
...
... return wrapper
...
>>> class Test():
...
... @decorator
... def method(self, text):
... print text
...
>>> ins = Test()
>>> ins.method(u"txt")
__main__.Test
>>>