How do I decorate an instance method with another class in Python 2.7?
问题 In Python 2.7 I'd like to decorate an instance method test in class Foo with a decorator that is also a class called FooTestDecorator . From user Chirstop's question and the Python 2 docs' Descriptor HowTo guide I created this example. There seems to be an issue however, when I print my decorated method object, it's (inspected?) name is wrong because it is noted as a question mark like Foo.? . import types class FooTestDecorator(object): def __init__(self,func): self.func=func self.count=0 #