Python Pandas global vs passed variable
large_dict = {
'blah1': {'also': 1},
'blah2': {'big': 1}
};
def do_something(k):
for key,val in large_dict[k].iteritems();
print "%s - %s" % (key,val)
do_something('blah1')
do_something('blah2')
正如您所见,正在从全局命名空间访问large_dict。