注解 Decorator

def hello(fn): 
    def wrapper(): 
        print "hello, %s" % fn.__name__ fn() 
        print "goodby, %s" % fn.__name__ 
    return wrapper

    @hello
    def foo(): 
        print "i am foo"foo()

results matching ""

    No results matching ""