Python装饰器笔记

时间:2014-07-22 23:10:25   收藏:0   阅读:460
bubuko.com,布布扣
def small(func):
    def getfunc():
        print "<small>"
        func()
        print "</small>"
    return getfunc
def strong(func):
    def getfunc():
        print "<strong>"
        func()
        print "</strong>"
    return getfunc
def text(text="HELLO WORLD"):
    print text
    
# newtext=small(strong(text))
# newtext()

@small
@strong
def text1(text="HELLO WORLD"):
    print text
text1()
bubuko.com,布布扣

原文:http://www.cnblogs.com/Xjng/p/3514791.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!