series of results over time this is another advanced topic covered later in this part of the book global declares module-level variables that are to be assigned by defaultall names assigned in function are local to that function and exist only while the function runs to assign name in the enclosing modulefunctions need to list it in global statement more generallynames are always looked up in scopes-places where variables are stored--and assignments bind names to scopes nonlocal declares enclosing function variables that are to be assigned similarlythe nonlocal statement added in python allows function to assign name that exists in the scope of syntactically enclosing def statement this allows enclosing functions to serve as place to retain state--information remembered between function calls--without using shared global names arguments are passed by assignment (object referencein pythonarguments are passed to functions by assignment (whichas we've learnedmeans by object referenceas you'll seein python' model the caller and function share objects by referencesbut there is no name aliasing changing an argument name within function does not also change the corresponding name in the callerbut changing passed-in mutable objects in place can change objects shared by the callerand serve as function result arguments are passed by positionunless you say otherwise values you pass in function call match argument names in function' definition from left to right by default for flexibilityfunction calls can also pass arguments by name with name=value keyword syntaxand unpack arbitrarily many arguments to send with *pargs and **kargs starred-argument notation function definitions use the same two forms to specify argument defaultsand collect arbitrarily many arguments received argumentsreturn valuesand variables are not declared as with everything in pythonthere are no type constraints on functions in factnothing about function needs to be declared ahead of timeyou can pass in arguments of any typereturn any kind of objectand so on as one consequencea single function can often be applied to variety of object types--any objects that sport compatible interface (methods and expressionswill doregardless of their specific types if some of the preceding words didn' sink indon' worry--we'll explore all of these concepts with real code in this part of the book let' get started by expanding on some of these ideas and looking at few examples def statements the def statement creates function object and assigns it to name its general format is as follows function basics