首页 > 编程语言 > 详细

Python--闭包测试

时间:2018-12-02 17:53:24      阅读:174      评论:0      收藏:0      [点我收藏+]
def Funx(x):
    def Funy(y):
        return x*y
    return Funy
print(Funx(5)(7))
def Fun1():
    x = 7
    def Fun2():
        nonlocal x
        x *= x
        return x
    return Fun2()
print(Fun1())

 

Python--闭包测试

原文:https://www.cnblogs.com/Essaycode/p/10054294.html

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