A function is a device to group a set of statements so they can be run more than once in a program.
def is executable code: your function does not exist until Python reaches and runs the def. in typical operation, def statements are
coded in module files and are naturally run to generate fucntions when the module files they reside in is first imported.
def creates an object and assigns it to a name.
lambda creates an object but returns it as a result
return sends a result object back to the caller
yield sends a result object back to the caller, but remembers where it left off.
global declares module-level variables that are to be assigned
nonlocal declares enclosing function variables that are to be assigned.
arguments are passed by assignment (object reference):
arguments are passed by postion, unless you say otherwise: values you pass in a function call match names in a function
defintion from left to right by default. function calls can also pass arguments by name with name=value keyword syntax,
and unpack arbitrarily many arguments to send with *pargs and **kargs starred-argument notation.
arguments, return values, and variables are not declared


雷达卡



京公网安备 11010802022788号







