python nested functions get variables from function scope code example
Example: python nested functions get variables from function scope
def a():
val = True
def b():
nonlocal val
val = False
def a():
val = True
def b():
nonlocal val
val = False