闭包

2017-07-29  本文已影响0人  Cytosine
>>> def funX(x):
    def funY(y):
        return x * y
    return funY

>>> i = funX(5)
>>> print(i)
<function funX.<locals>.funY at 0x00000211C3D16A60>
>>> type(i)
<class 'function'>
>>> i(5)
25
>>> funX(5)(6)
30
上一篇下一篇

猜你喜欢

热点阅读