It's unrelated to the for loop, the for only changes the variable, there are other ways you can do that and you'll run into the same "oddity"
def test():
n = 0
def a():
return n
n = 1
def b():
return n
return a, b
a, b = test()
a() == 1
b() == 1