局部状态

def creator():
    state = 0
    def action():
        nonlocal state    #没有这行会报错
        state = state + 1 #出现在左边的state表示要为当前frame绑定state,那右边的state怎么办,当前frame没有state
        print(state)
    return action

一个叫约束连接的有趣例子

将等式用图的形式表达,实现时,“用一个个组件拼接起来”

python中的面向对象