Mega Code Archive

 
Categories / Python Tutorial / Function
 

Nested functions

def outer():    def inner():       print "\nFunction inner executing"       print "The objects in inner's scope are:", dir()       print "Function inner finishing"    print "Function outer executing"    print "The objects in outer's scope are:", dir()    inner()    print "\nFunction outer finishing" print "The objects in the global scope are:" print dir() print "\nCalling function outer\n" outer() print "\nFunction outer finished"