All pastes #790358 Raw Edit

Someone

public text v1 · immutable
·published 2007-11-20 09:39 UTC
rendered paste body
import a
from b import bar

note = """
a and b are very similar and look like this:
# this is module a.py
def foo():
    global globaldict
    globaldict = {}
    globaldict["A"] = True
"""

def baz():
    global globaldict
    globaldict = {}
    globaldict["C"] = True

a.foo()
try:
    print globaldict
except:
    print "NO GLOBAL DICT AFTER a.foo()"
bar()
try:
    print globaldict
except:
    print "NO GLOBAL DICT AFTER b.bar()"

baz()
try:
    print globaldict
except:
    print "NO GLOBAL DICT AFTER baz()"

output = """
NO GLOBAL DICT AFTER a.foo()
NO GLOBAL DICT AFTER b.bar()
{'C': True}
"""