This has nothing to do with your update to the globals
dict specifically. You'd get exactly the same result if you did this:
a = 1
def foo():
print a
if False: a = 0
foo()
That's because any assignment to a variable that's not explicitly marked as global
within a scope makes the variable local throughout that scope.