Discuss / Python / 脑子还是别不过来,断点跟踪能明白,过一会还是感觉绕

脑子还是别不过来,断点跟踪能明白,过一会还是感觉绕

Topic source
def createCounter():
    a = 0

    def counter():
        nonlocal a
        a += 1
        return a

    return counter


counterA = createCounter()

  • 1

Reply