# outer functiong = "globalVar"def foo(stuff): # in here, the scope is foo, anything can be defined, a class another # function, whatever. Since the scope is "inside foo" whatever variables # you can access inside foo at call time, will be available. These are # foo local variables, and globals z = 12 def bar(x): #the scope here is "inside bar" you can access bar local variables, # foo local variables, and globals print "global g is ", g, " foo z is", z, " foo stuff at call time is ", stuff print "bar was called with x of ", x return bar# now we can call foo to get the function bar, which will create a new instance# of bar each time it is run (since def bar... is just some statement to be# run when foo is calledbar1 = foo('first call')bar2 = foo('second call')print "bar1 is bar2: ", bar1 is bar2print "bar1(2):"bar1(2)print "bar2(18):"bar2(18)print "bar1(22)"bar2(22)