首页 > 编程语言 > 详细

Python装饰器笔记

时间:2014-07-22 23:10:25      阅读:459      评论:0      收藏:0      [点我收藏+]
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,布布扣

Python装饰器笔记

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

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!