Quick actions

cmd+k|ctrl+k

Navigation

Languages

closure e.g.

Snippet info

Language

Python

Visibility

public

Author

gordonchu88

Created

2024-10-07T01:59:49.006963Z

Updated

2024-10-07T02:00:40.984909Z

def outer():
    x = 'hello'
    def inner1():
        x = 'python'
        def inner2():
            nonlocal x
            x = 'monty'
        print('inner (before):', x)
        inner2()
        print('inner (after):',x)
    inner1()
    print('outer:', x)
outer()
INFO