or strings the followingfor exampleembeds the function twice in list of tuplesas sort of actions table because python compound types like these can contain any sort of objectthere' no special case hereeitherschedule (echo'spam!')(echo'ham!'for (funcargin schedulefunc(argcall functions embedded in containers spamhamthis code simply steps through the schedule listcalling the echo function with one argument each time through (notice the tuple-unpacking assignment in the for loop headerintroduced in as we saw in ' examplesfunctions can also be created and returned for use elsewhere--the closure created in this mode also retains state from the enclosing scopedef make(label)make function but don' call it def echo(message)print(label ':messagereturn echo make('spam' ('ham!'spam:hamf('eggs!'spam:eggslabel in enclosing scope is retained call the function that make returned python' universal first-class object model and lack of type declarations make for an incredibly flexible programming language function introspection because they are objectswe can also process functions with normal object tools in factfunctions are more flexible than you might expect for instanceonce we make functionwe can call it as usualdef func( ) 'spamreturn func( 'spamspamspamspamspamspamspamspambut the call expression is just one operation defined to work on function objects we can also inspect their attributes generically (the following is run in python but results are similar)func __name__ 'funcdir(func['__annotations__''__call__''__class__''__closure__''__code__'function objectsattributes and annotations